We are seeing some new test failures in SciPy after a refactor from regular usage of pytest.warns to code that looks like this:
warn_ctx = (
contextlib.nullcontext() if check_condition(x)
else pytest.warns(RuntimeWarning, match="Precision loss occurred..."))
with warn_ctx:
xp_assert_equal(stats.skew(a), xp.asarray(xp.nan))
See scipy/scipy#22758 (comment).
pytest-run-parallel apparently does not pick up the pytest.warns usage here and hence doesn't mark the test as thread-unsafe.
We can now use the mechanism from gh-37 to handle this more easily on the SciPy side. It'd be good to check that this wasn't a regression on the pytest-run-parallel side in 0.4.0 though.