From 37d843bb6736cb2e8b0d38ddc886a7f25e2ae9b7 Mon Sep 17 00:00:00 2001 From: Oliver Holworthy <1216955+oliverholworthy@users.noreply.github.com> Date: Thu, 22 Jun 2023 19:39:01 +0100 Subject: [PATCH 1/2] Add pytest.ini with markers specified --- pytest.ini | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 pytest.ini 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 From f0e32a5a25139ed61e8ce956b0dc527508fd95fb Mon Sep 17 00:00:00 2001 From: Oliver Holworthy <1216955+oliverholworthy@users.noreply.github.com> Date: Thu, 22 Jun 2023 19:39:16 +0100 Subject: [PATCH 2/2] Update conftest with automatic markers based on test path --- tests/conftest.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/tests/conftest.py b/tests/conftest.py index 3c3ae4373b..5b88ce8f63 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -371,3 +371,26 @@ def devices(request): @pytest.fixture 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"))