summaryrefslogtreecommitdiff
path: root/tests/test_oddball.py
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2021-05-30 17:39:20 -0400
committerNed Batchelder <ned@nedbatchelder.com>2021-05-30 18:03:05 -0400
commit30c023b5b74f9c798645cbb3f35362ae046a4c25 (patch)
treee86df1a4c044ec9b2919068297dfd91a382eeb84 /tests/test_oddball.py
parent22fe2eb167a18dda8fd3e14cbf9166a1c7331fb9 (diff)
downloadpython-coveragepy-git-30c023b5b74f9c798645cbb3f35362ae046a4c25.tar.gz
feat: warnings are now real warnings
This makes coverage warnings visible when running test suites under pytest. But it also means some uninteresting warnings would show up in our own test suite, so we had to catch or suppress those.
Diffstat (limited to 'tests/test_oddball.py')
-rw-r--r--tests/test_oddball.py26
1 files changed, 14 insertions, 12 deletions
diff --git a/tests/test_oddball.py b/tests/test_oddball.py
index 52f80734..a97fc190 100644
--- a/tests/test_oddball.py
+++ b/tests/test_oddball.py
@@ -81,17 +81,18 @@ 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):
- self.check_coverage("""\
- def recur(n):
- if n == 0:
- return 0
- else:
- return recur(n-1)+1
-
- recur(100000) # This is definitely too many frames.
- """,
- [1, 2, 3, 5, 7], ""
- )
+ with pytest.warns(None):
+ self.check_coverage("""\
+ def recur(n):
+ if n == 0:
+ return 0
+ else:
+ return recur(n-1)+1
+
+ recur(100000) # This is definitely too many frames.
+ """,
+ [1, 2, 3, 5, 7], ""
+ )
def test_long_recursion_recovery(self):
# Test the core of bug 93: https://github.com/nedbat/coveragepy/issues/93
@@ -117,7 +118,8 @@ class RecursionTest(CoverageTest):
""")
cov = coverage.Coverage()
- self.start_import_stop(cov, "recur")
+ with pytest.warns(None):
+ self.start_import_stop(cov, "recur")
pytrace = (cov._collector.tracer_name() == "PyTracer")
expected_missing = [3]