mirror of https://github.com/pytest-dev/pytest.git
[4.6] tests: restore tracing function
Without this, `testing/test_pdb.py` (already without pexpect) will cause missing test coverage afterwards (for the same process).
This commit is contained in:
parent
21680ffa77
commit
1b7597ac91
|
@ -1,6 +1,21 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
import sys
|
||||
|
||||
import pytest
|
||||
|
||||
if sys.gettrace():
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
def restore_tracing():
|
||||
"""Restore tracing function (when run with Coverage.py).
|
||||
|
||||
https://bugs.python.org/issue37011
|
||||
"""
|
||||
orig_trace = sys.gettrace()
|
||||
yield
|
||||
if sys.gettrace() != orig_trace:
|
||||
sys.settrace(orig_trace)
|
||||
|
||||
|
||||
@pytest.hookimpl(hookwrapper=True, tryfirst=True)
|
||||
def pytest_collection_modifyitems(config, items):
|
||||
|
|
Loading…
Reference in New Issue