Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[minor/QoL] monkeypatch.delenv PYTHONBREAKPOINT in two tests that previously failed/skipped #12051

Merged
merged 1 commit into from Mar 3, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
18 changes: 8 additions & 10 deletions testing/test_debugging.py
@@ -1,5 +1,4 @@
# mypy: allow-untyped-defs
import os
import sys
from typing import List

Expand All @@ -10,9 +9,6 @@
import pytest


_ENVIRON_PYTHONBREAKPOINT = os.environ.get("PYTHONBREAKPOINT", "")


@pytest.fixture(autouse=True)
def pdb_env(request):
if "pytester" in request.fixturenames:
Expand Down Expand Up @@ -959,7 +955,10 @@ def test_nothing(): pass
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():
Expand Down Expand Up @@ -1003,11 +1002,10 @@ def test_nothing(): pass
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():
Expand Down