Skip to content

Commit 9497ecd

Browse files
committed
Don't enable the add_api_name_to_metadata fixture unless --json-report is used
1 parent 05c7802 commit 9497ecd

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

conftest.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
from pathlib import Path
33

44
from hypothesis import settings
5-
from pytest import mark
5+
from pytest import mark, fixture
66

77
from array_api_tests import _array_module as xp
88
from array_api_tests._array_module import _UndefinedStub
@@ -126,3 +126,6 @@ def pytest_collection_modifyitems(config, items):
126126
ci_mark = next((m for m in markers if m.name == "ci"), None)
127127
if ci_mark is None:
128128
item.add_marker(mark.skip(reason="disabled via --ci"))
129+
130+
if config.getoption('--json-report'):
131+
fixture(autouse=True)(add_api_name_to_metadata)

reporting.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@ def pytest_metadata(metadata):
3838
metadata['array_api_tests_module'] = xp.mod_name
3939
metadata['array_api_tests_version'] = __version__
4040

41-
@fixture(autouse=True)
41+
# This is dynamically decorated as a fixture in pytest_collection_modifyitems
42+
# when --json-report is used.
4243
def add_api_name_to_metadata(request, json_metadata):
4344
"""
4445
Additional per-test metadata for --json-report

0 commit comments

Comments
 (0)