diff --git a/ecs/crm-datafetch/Pipfile b/ecs/crm-datafetch/Pipfile index 82796598..6912e1a0 100644 --- a/ecs/crm-datafetch/Pipfile +++ b/ecs/crm-datafetch/Pipfile @@ -7,6 +7,7 @@ name = "pypi" test = "pytest tests/" "test:cov" = "pytest --cov=src --cov-branch --cov-report=term-missing tests/" "test:report" = "pytest --cov=src --cov-branch --cov-report=term-missing --html=.report/test_result.html tests/" +"test:walk-through" = "pytest tests/ --walk-through" [packages] boto3 = "*" diff --git a/ecs/crm-datafetch/tests/conftest.py b/ecs/crm-datafetch/tests/conftest.py index 55ade88c..b86b29d9 100644 --- a/ecs/crm-datafetch/tests/conftest.py +++ b/ecs/crm-datafetch/tests/conftest.py @@ -57,3 +57,23 @@ def pytest_runtest_makereport(item, call): report.cases = docstring.get("Cases", '') # 「テスト内容」を`report`に追加 report.arranges = docstring.get("Arranges", '') # 「準備作業」を`report`に追加 report.expects = docstring.get("Expects", '') # 「期待結果」を`report`に追加 + + +def pytest_addoption(parser): + parser.addoption( + "--walk-through", action="store_true", default=False, help="run walk through tests" + ) + + +def pytest_configure(config): + config.addinivalue_line("markers", "slow: mark test as slow to run") + + +def pytest_collection_modifyitems(config, items): + skip_slow = pytest.mark.skip(reason="need --walk-through option to run") + if config.getoption("--walk-through"): + [item.add_marker(skip_slow) for item in items if "walk_through" not in item.keywords] + return + for item in items: + if "walk_through" in item.keywords: + item.add_marker(skip_slow) diff --git a/ecs/crm-datafetch/tests/test_walkthrough.py b/ecs/crm-datafetch/tests/test_walkthrough.py new file mode 100644 index 00000000..2a3b09f2 --- /dev/null +++ b/ecs/crm-datafetch/tests/test_walkthrough.py @@ -0,0 +1,7 @@ +import pytest + + +@pytest.mark.walk_through +def test_walk_through(): + assert 0 + pass