Skip to content

use of pytest.warns not detected - possible regression in 0.4.0 #50

@rgommers

Description

@rgommers

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions