summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Douard <david.douard@logilab.fr>2014-11-30 11:12:22 +0100
committerDavid Douard <david.douard@logilab.fr>2014-11-30 11:12:22 +0100
commit49f441b56a6235baf6f33b97600a005456f2a443 (patch)
treef1f32b2930c620897d814376fee03b5f11752d3f
parent93251cb8463691aa644f808e9295625d5ad89adb (diff)
downloadlogilab-common-49f441b56a6235baf6f33b97600a005456f2a443.tar.gz
[coverage] fix a bug breaking coverage.py (closes #281908)
The refactoring of the coverage suspend/resume tools in pytest done in 31725b8fa3f5 breaks the compatibility of theses tools with coverage.py, due to a bug in this later project, see: https://bitbucket.org/ned/coveragepy/issue/123
-rw-r--r--pytest.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/pytest.py b/pytest.py
index c0f84ac..58515a9 100644
--- a/pytest.py
+++ b/pytest.py
@@ -157,6 +157,11 @@ def replace_trace(trace=None):
try:
yield
finally:
+ # specific hack to work around a bug in pycoverage, see
+ # https://bitbucket.org/ned/coveragepy/issue/123
+ if (oldtrace is not None and not callable(oldtrace) and
+ hasattr(oldtrace, 'pytrace')):
+ oldtrace = oldtrace.pytrace
sys.settrace(oldtrace)