Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
tests: restore tracing function
Without this, `testing/test_pdb.py` (already without pexpect) will cause
missing test coverage afterwards (for the same process).
  • Loading branch information
blueyed committed Jun 5, 2019
commit aab568709324e3d90c0b493b18125c1f5d223dd6
15 changes: 15 additions & 0 deletions testing/conftest.py
Original file line number Diff line number Diff line change
@@ -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):
Expand Down