diff options
-rw-r--r-- | setup.cfg | 3 | ||||
-rw-r--r-- | tests/conftest.py | 2 | ||||
-rw-r--r-- | tests/helpers.py | 4 |
3 files changed, 6 insertions, 3 deletions
@@ -1,3 +1,6 @@ +# Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0 +# For details: https://github.com/nedbat/coveragepy/blob/master/NOTICE.txt + [tool:pytest] addopts = -q -n3 --strict-markers --force-flaky --no-flaky-report -rfeX --failed-first python_classes = *Test diff --git a/tests/conftest.py b/tests/conftest.py index c84f446a..4ae11542 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -27,7 +27,7 @@ pytest.register_assert_rewrite("tests.helpers") @pytest.fixture(autouse=True) def set_warnings(): - """Enable DeprecationWarnings during all tests.""" + """Configure warnings to show while running tests.""" warnings.simplefilter("default") warnings.simplefilter("once", DeprecationWarning) diff --git a/tests/helpers.py b/tests/helpers.py index 40b0f481..3b0e1283 100644 --- a/tests/helpers.py +++ b/tests/helpers.py @@ -265,11 +265,11 @@ def assert_count_equal(a, b): def assert_coverage_warnings(warns, *msgs): """ - Assert that `warns` are all CoverageWarning's, and have `msgs` as messages. + Assert that the CoverageWarning's in `warns` have `msgs` as messages. """ assert msgs # don't call this without some messages. + warns = [w for w in warns if issubclass(w.category, CoverageWarning)] assert len(warns) == len(msgs) - assert all(w.category == CoverageWarning for w in warns) for actual, expected in zip((w.message.args[0] for w in warns), msgs): if hasattr(expected, "search"): assert expected.search(actual), f"{actual!r} didn't match {expected!r}" |