Merge pull request #4028 from asottile/revert_breakpoint_code
Revert patching of breakpointhook as it appears to do nothing
This commit is contained in:
1
changelog/4028.trivial.rst
Normal file
1
changelog/4028.trivial.rst
Normal file
@@ -0,0 +1 @@
|
||||
Revert patching of ``sys.breakpointhook`` since it appears to do nothing.
|
||||
@@ -9,13 +9,6 @@ from doctest import UnexpectedException
|
||||
from _pytest import outcomes
|
||||
from _pytest.config import hookimpl
|
||||
|
||||
try:
|
||||
from builtins import breakpoint # noqa
|
||||
|
||||
SUPPORTS_BREAKPOINT_BUILTIN = True
|
||||
except ImportError:
|
||||
SUPPORTS_BREAKPOINT_BUILTIN = False
|
||||
|
||||
|
||||
def pytest_addoption(parser):
|
||||
group = parser.getgroup("general")
|
||||
@@ -53,20 +46,12 @@ def pytest_configure(config):
|
||||
if config.getvalue("usepdb"):
|
||||
config.pluginmanager.register(PdbInvoke(), "pdbinvoke")
|
||||
|
||||
# Use custom Pdb class set_trace instead of default Pdb on breakpoint() call
|
||||
if SUPPORTS_BREAKPOINT_BUILTIN:
|
||||
_environ_pythonbreakpoint = os.environ.get("PYTHONBREAKPOINT", "")
|
||||
if _environ_pythonbreakpoint == "":
|
||||
sys.breakpointhook = pytestPDB.set_trace
|
||||
|
||||
old = (pdb.set_trace, pytestPDB._pluginmanager)
|
||||
|
||||
def fin():
|
||||
pdb.set_trace, pytestPDB._pluginmanager = old
|
||||
pytestPDB._config = None
|
||||
pytestPDB._pdb_cls = pdb.Pdb
|
||||
if SUPPORTS_BREAKPOINT_BUILTIN:
|
||||
sys.breakpointhook = sys.__breakpointhook__
|
||||
|
||||
pdb.set_trace = pytestPDB.set_trace
|
||||
pytestPDB._pluginmanager = config.pluginmanager
|
||||
|
||||
@@ -4,9 +4,15 @@ import platform
|
||||
import os
|
||||
|
||||
import _pytest._code
|
||||
from _pytest.debugging import SUPPORTS_BREAKPOINT_BUILTIN
|
||||
import pytest
|
||||
|
||||
try:
|
||||
breakpoint
|
||||
except NameError:
|
||||
SUPPORTS_BREAKPOINT_BUILTIN = False
|
||||
else:
|
||||
SUPPORTS_BREAKPOINT_BUILTIN = True
|
||||
|
||||
|
||||
_ENVIRON_PYTHONBREAKPOINT = os.environ.get("PYTHONBREAKPOINT", "")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user