summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2021-07-20 06:49:19 -0400
committerNed Batchelder <ned@nedbatchelder.com>2021-07-20 05:32:28 -0700
commit9f8d8d9aa8997c792765d0c553890fb2c3c67bdd (patch)
tree5be2a7a2ac6161fb2d6b8ef18b1058212ca9b705
parent48f884c33a75ef35b759be6b8d6afdf7645e3517 (diff)
downloadpython-coveragepy-git-9f8d8d9aa8997c792765d0c553890fb2c3c67bdd.tar.gz
test: check the plugin warnings differently
The old way, extra warnings that we don't care about could creep in. For some reason, disabling PyContracts causes "imp" DeprecationWarnings to appear in the list. Rather than assert there's only one warning, assert there's only one from us.
-rw-r--r--tests/test_plugins.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/tests/test_plugins.py b/tests/test_plugins.py
index b15ee45b..ca0e6dac 100644
--- a/tests/test_plugins.py
+++ b/tests/test_plugins.py
@@ -647,8 +647,9 @@ class BadFileTracerTest(FileTracerTest):
# Disabling plug-in '...' due to previous exception
# or:
# Disabling plug-in '...' due to an exception:
+ print([str(w) for w in warns.list])
+ warns = [w for w in warns.list if issubclass(w.category, CoverageWarning)]
assert len(warns) == 1
- assert issubclass(warns[0].category, CoverageWarning)
warnmsg = warns[0].message.args[0]
assert f"Disabling plug-in '{module_name}.{plugin_name}' due to " in warnmsg