From 9f8d8d9aa8997c792765d0c553890fb2c3c67bdd Mon Sep 17 00:00:00 2001 From: Ned Batchelder Date: Tue, 20 Jul 2021 06:49:19 -0400 Subject: 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. --- tests/test_plugins.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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 -- cgit v1.2.1