Skip to content

Commit 8c0a5a6

Browse files
committed
Fix interference with pytest-run-parallel detection of known thread-unsafe calls
1 parent 56809c5 commit 8c0a5a6

1 file changed

Lines changed: 9 additions & 6 deletions

File tree

pytest_arraydiff/plugin.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -266,10 +266,6 @@ def __init__(self, config, reference_dir=None, generate_dir=None, default_format
266266
self.default_format = default_format
267267
self.return_value = {}
268268

269-
def pytest_collection_modifyitems(self, items):
270-
for item in items:
271-
wrap_array_interceptor(self, item)
272-
273269
@pytest.hookimpl(hookwrapper=True)
274270
def pytest_runtest_call(self, item):
275271

@@ -308,6 +304,8 @@ def pytest_runtest_call(self, item):
308304

309305
baseline_remote = reference_dir.startswith('http')
310306

307+
# Run test and get array object
308+
wrap_array_interceptor(self, item)
311309
yield
312310
test_name = generate_test_name(item)
313311
if test_name not in self.return_value:
@@ -380,6 +378,11 @@ def __init__(self, config):
380378
self.config = config
381379
self.return_value = {}
382380

383-
def pytest_collection_modifyitems(self, items):
384-
for item in items:
381+
@pytest.hookimpl(hookwrapper=True)
382+
def pytest_runtest_call(self, item):
383+
384+
if item.get_closest_marker('array_compare') is not None:
385385
wrap_array_interceptor(self, item)
386+
387+
yield
388+
return

0 commit comments

Comments
 (0)