Skip to content

Commit

Permalink
[4.6] tests: restore tracing function (#5408)
Browse files Browse the repository at this point in the history
[4.6] tests: restore tracing function
  • Loading branch information
nicoddemus committed Jun 5, 2019
2 parents 21680ff + 1b7597a commit 1cae76b
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions testing/conftest.py
@@ -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):
Expand Down

0 comments on commit 1cae76b

Please sign in to comment.