summaryrefslogtreecommitdiff
path: root/tests/test_plugins.py
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2021-12-09 12:24:12 -0500
committerNed Batchelder <ned@nedbatchelder.com>2022-02-04 06:38:50 -0500
commit340c56ba503f0000bf684110c2a8c8ade9d5d60b (patch)
tree9713c428526e29df9a113ae20a41ed5e9c98ff12 /tests/test_plugins.py
parentcf712c665dffcd2e1e939b9eb079974449437828 (diff)
downloadpython-coveragepy-git-340c56ba503f0000bf684110c2a8c8ade9d5d60b.tar.gz
refactor(test): a context manager to swallow warnings
Diffstat (limited to 'tests/test_plugins.py')
-rw-r--r--tests/test_plugins.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/tests/test_plugins.py b/tests/test_plugins.py
index 45b3bc9e..edf849f6 100644
--- a/tests/test_plugins.py
+++ b/tests/test_plugins.py
@@ -21,7 +21,7 @@ from coverage.misc import import_local_file
import coverage.plugin
from tests.coveragetest import CoverageTest
-from tests.helpers import CheckUniqueFilenames
+from tests.helpers import CheckUniqueFilenames, swallow_warnings
class FakeConfig:
@@ -194,8 +194,9 @@ class PluginTest(CoverageTest):
cov = coverage.Coverage(debug=["sys"])
cov._debug_file = debug_out
cov.set_option("run:plugins", ["plugin_sys_info"])
- with pytest.warns(None):
- # Catch warnings so we don't see "plugins aren't supported on PyTracer"
+ with swallow_warnings(
+ r"Plugin file tracers \(plugin_sys_info.Plugin\) aren't supported with PyTracer"
+ ):
cov.start()
cov.stop() # pragma: nested