From 5e2ee7175c145f84ff9882be9496abb56e6e56f2 Mon Sep 17 00:00:00 2001
From: jakkdl
Date: Sun, 3 Mar 2024 13:48:29 +0100
Subject: [PATCH] monkeypatch.delenv PYTHONBREAKPOINT in two tests that
previously failed/skipped
---
testing/test_debugging.py | 18 ++++++++----------
1 file changed, 8 insertions(+), 10 deletions(-)
diff --git a/testing/test_debugging.py b/testing/test_debugging.py
index 02ad700a6..91a0be481 100644
--- a/testing/test_debugging.py
+++ b/testing/test_debugging.py
@@ -1,5 +1,4 @@
# mypy: allow-untyped-defs
-import os
import sys
from typing import List
@@ -10,9 +9,6 @@ from _pytest.pytester import Pytester
import pytest
-_ENVIRON_PYTHONBREAKPOINT = os.environ.get("PYTHONBREAKPOINT", "")
-
-
@pytest.fixture(autouse=True)
def pdb_env(request):
if "pytester" in request.fixturenames:
@@ -959,7 +955,10 @@ class TestDebuggingBreakpoints:
result = pytester.runpytest_subprocess(*args)
result.stdout.fnmatch_lines(["*1 passed in *"])
- def test_pdb_custom_cls(self, pytester: Pytester, custom_debugger_hook) -> None:
+ def test_pdb_custom_cls(
+ self, pytester: Pytester, custom_debugger_hook, monkeypatch: MonkeyPatch
+ ) -> None:
+ monkeypatch.delenv("PYTHONBREAKPOINT", raising=False)
p1 = pytester.makepyfile(
"""
def test_nothing():
@@ -1003,11 +1002,10 @@ class TestDebuggingBreakpoints:
result = pytester.runpytest_subprocess(*args)
result.stdout.fnmatch_lines(["*1 passed in *"])
- @pytest.mark.skipif(
- not _ENVIRON_PYTHONBREAKPOINT == "",
- reason="Requires breakpoint() default value",
- )
- def test_sys_breakpoint_interception(self, pytester: Pytester) -> None:
+ def test_sys_breakpoint_interception(
+ self, pytester: Pytester, monkeypatch: MonkeyPatch
+ ) -> None:
+ monkeypatch.delenv("PYTHONBREAKPOINT", raising=False)
p1 = pytester.makepyfile(
"""
def test_1():