monkeypatch.delenv PYTHONBREAKPOINT in two tests that previously failed/skipped

This commit is contained in:
jakkdl 2024-03-03 13:48:29 +01:00
parent 6ed005161d
commit 5e2ee7175c
1 changed files with 8 additions and 10 deletions

View File

@ -1,5 +1,4 @@
# mypy: allow-untyped-defs # mypy: allow-untyped-defs
import os
import sys import sys
from typing import List from typing import List
@ -10,9 +9,6 @@ from _pytest.pytester import Pytester
import pytest import pytest
_ENVIRON_PYTHONBREAKPOINT = os.environ.get("PYTHONBREAKPOINT", "")
@pytest.fixture(autouse=True) @pytest.fixture(autouse=True)
def pdb_env(request): def pdb_env(request):
if "pytester" in request.fixturenames: if "pytester" in request.fixturenames:
@ -959,7 +955,10 @@ class TestDebuggingBreakpoints:
result = pytester.runpytest_subprocess(*args) result = pytester.runpytest_subprocess(*args)
result.stdout.fnmatch_lines(["*1 passed in *"]) 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( p1 = pytester.makepyfile(
""" """
def test_nothing(): def test_nothing():
@ -1003,11 +1002,10 @@ class TestDebuggingBreakpoints:
result = pytester.runpytest_subprocess(*args) result = pytester.runpytest_subprocess(*args)
result.stdout.fnmatch_lines(["*1 passed in *"]) result.stdout.fnmatch_lines(["*1 passed in *"])
@pytest.mark.skipif( def test_sys_breakpoint_interception(
not _ENVIRON_PYTHONBREAKPOINT == "", self, pytester: Pytester, monkeypatch: MonkeyPatch
reason="Requires breakpoint() default value", ) -> None:
) monkeypatch.delenv("PYTHONBREAKPOINT", raising=False)
def test_sys_breakpoint_interception(self, pytester: Pytester) -> None:
p1 = pytester.makepyfile( p1 = pytester.makepyfile(
""" """
def test_1(): def test_1():