diff --git a/pytest.ini b/pytest.ini new file mode 100644 index 0000000000..70cd77bbaf --- /dev/null +++ b/pytest.ini @@ -0,0 +1,10 @@ +[pytest] +markers = + unit: mark as unit test + examples: mark as example + ops: mark as tesing operators + loader: mark as testing the dataloader + tensorflow: mark as using tensorflow + torch: mark as using torch + singlegpu: mark as testing single GPU + multigpu: mark as testing multi-GPU diff --git a/tests/conftest.py b/tests/conftest.py index b8ed0a32f6..f1e05da2f5 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -374,6 +374,29 @@ def report(request): return request.config.getoption("--report") +def pytest_collection_modifyitems(items): + for item in items: + path = item.location[0] + + if "/unit/" in path: + item.add_marker(getattr(pytest.mark, "unit")) + + if "/loader/" in path: + item.add_marker(getattr(pytest.mark, "loader")) + + if "/examples/" in path: + item.add_marker(getattr(pytest.mark, "examples")) + + if "/ops/" in path: + item.add_marker(getattr(pytest.mark, "ops")) + + if "test_tf_" in path: + item.add_marker(getattr(pytest.mark, "tensorflow")) + + if "test_torch_" in path: + item.add_marker(getattr(pytest.mark, "torch")) + + @pytest.fixture(scope="function", autouse=True) def cleanup_dataloader(): """After each test runs. Call .stop() on any dataloaders created during the test.