Merge pull request #5406 from blueyed/restore-tracing
tests: restore tracing function
This commit is contained in:
commit
190456aeda
|
@ -1,5 +1,20 @@
|
|||
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