diff options
| author | Ned Batchelder <ned@nedbatchelder.com> | 2021-12-09 12:24:12 -0500 |
|---|---|---|
| committer | Ned Batchelder <ned@nedbatchelder.com> | 2022-02-04 06:38:50 -0500 |
| commit | 340c56ba503f0000bf684110c2a8c8ade9d5d60b (patch) | |
| tree | 9713c428526e29df9a113ae20a41ed5e9c98ff12 /tests/test_oddball.py | |
| parent | cf712c665dffcd2e1e939b9eb079974449437828 (diff) | |
| download | python-coveragepy-git-340c56ba503f0000bf684110c2a8c8ade9d5d60b.tar.gz | |
refactor(test): a context manager to swallow warnings
Diffstat (limited to 'tests/test_oddball.py')
| -rw-r--r-- | tests/test_oddball.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/tests/test_oddball.py b/tests/test_oddball.py index e2c17517..9536c121 100644 --- a/tests/test_oddball.py +++ b/tests/test_oddball.py @@ -16,6 +16,7 @@ from coverage.files import abs_file from coverage.misc import import_local_file from tests.coveragetest import CoverageTest +from tests.helpers import swallow_warnings from tests import osinfo @@ -82,7 +83,7 @@ class RecursionTest(CoverageTest): def test_long_recursion(self): # We can't finish a very deep recursion, but we don't crash. with pytest.raises(RuntimeError): - with pytest.warns(None): + with swallow_warnings("Trace function changed, measurement is likely wrong: None"): self.check_coverage("""\ def recur(n): if n == 0: @@ -119,7 +120,7 @@ class RecursionTest(CoverageTest): """) cov = coverage.Coverage() - with pytest.warns(None): + with swallow_warnings("Trace function changed, measurement is likely wrong: None"): self.start_import_stop(cov, "recur") pytrace = (cov._collector.tracer_name() == "PyTracer") |
