diff options
author | Ned Batchelder <ned@nedbatchelder.com> | 2021-05-31 14:36:08 -0400 |
---|---|---|
committer | Ned Batchelder <ned@nedbatchelder.com> | 2021-05-31 14:38:07 -0400 |
commit | 65d9e0edbca0dc893ca70fbf64969e2ddc5a3680 (patch) | |
tree | 406eac9e175c8a92e9d36d1e417e5681247fd4b0 /tests/helpers.py | |
parent | e1cd8f8cf2c958ef0a7915011c58d3c1d9fdb64c (diff) | |
download | python-coveragepy-git-65d9e0edbca0dc893ca70fbf64969e2ddc5a3680.tar.gz |
test: better checking for CoverageWarnings
On Python 3.10, we were getting other warnings mixed into the warnings the tests
were looking for. This change lets us only look at the CoverageWarnings.
Diffstat (limited to 'tests/helpers.py')
-rw-r--r-- | tests/helpers.py | 4 |
1 files changed, 2 insertions, 2 deletions
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}" |