Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Pytest Markers Configuration #1849

Merged
merged 5 commits into from
Jul 4, 2023
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions pytest.ini
Original file line number Diff line number Diff line change
@@ -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
23 changes: 23 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"))
Loading