From 7ef44913a1ee5c79c966372e613ce3ea06a68090 Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Fri, 18 Oct 2019 17:08:39 +0200 Subject: [PATCH] tests: debugging: disable pdb++ within inner tests Ref: https://github.com/pytest-dev/pytest/pull/5306#issuecomment-495690643 --- testing/test_pdb.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/testing/test_pdb.py b/testing/test_pdb.py index 3c56f40e1..924c2f4af 100644 --- a/testing/test_pdb.py +++ b/testing/test_pdb.py @@ -17,6 +17,14 @@ else: _ENVIRON_PYTHONBREAKPOINT = os.environ.get("PYTHONBREAKPOINT", "") +@pytest.fixture(autouse=True) +def pdb_env(request): + if "testdir" in request.fixturenames: + # Disable pdb++ with inner tests. + testdir = request.getfixturevalue("testdir") + testdir._env_run_update["PDBPP_HIJACK_PDB"] = "0" + + def runpdb_and_get_report(testdir, source): p = testdir.makepyfile(source) result = testdir.runpytest_inprocess("--pdb", p)