mirror of
https://github.com/python/cpython.git
synced 2025-08-30 21:48:47 +00:00
Issue #10992: make tests pass when run under coverage.
Various tests fail when run under coverage. A primary culprit is refcount tests which fail as the counts are thrown off by the coverage code. A new decorator -- test.support.refcount_test -- is used to decorate tests which test refcounts and to skip them when running under coverage. Other tests simply fail because of changes in the system (e.g., __local__ suddenly appearing). Thanks to Kristian Vlaardingerbroek for helping to diagnose the test failures.
This commit is contained in:
parent
eb70e47d85
commit
7a54073a56
13 changed files with 58 additions and 4 deletions
|
@ -1124,6 +1124,17 @@ def no_tracing(func):
|
|||
return wrapper
|
||||
|
||||
|
||||
def refcount_test(test):
|
||||
"""Decorator for tests which involve reference counting.
|
||||
|
||||
To start, the decorator does not run the test if is not run by CPython.
|
||||
After that, any trace function is unset during the test to prevent
|
||||
unexpected refcounts caused by the trace function.
|
||||
|
||||
"""
|
||||
return no_tracing(cpython_only(test))
|
||||
|
||||
|
||||
def _run_suite(suite):
|
||||
"""Run tests from a unittest.TestSuite-derived class."""
|
||||
if verbose:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue