MCPcopy
hub / github.com/pytest-dev/pytest / pytest_configure

Function pytest_configure

src/_pytest/debugging.py:65–89  ·  view source on GitHub ↗
(config: Config)

Source from the content-addressed store, hash-verified

63
64
65def pytest_configure(config: Config) -> None:
66 import pdb
67
68 if config.getvalue("trace"):
69 config.pluginmanager.register(PdbTrace(), "pdbtrace")
70 if config.getvalue("usepdb"):
71 config.pluginmanager.register(PdbInvoke(), "pdbinvoke")
72
73 pytestPDB._saved.append(
74 (pdb.set_trace, pytestPDB._pluginmanager, pytestPDB._config)
75 )
76 pdb.set_trace = pytestPDB.set_trace
77 pytestPDB._pluginmanager = config.pluginmanager
78 pytestPDB._config = config
79
80 # NOTE: not using pytest_unconfigure, since it might get called although
81 # pytest_configure was not (if another plugin raises UsageError).
82 def fin() -> None:
83 (
84 pdb.set_trace,
85 pytestPDB._pluginmanager,
86 pytestPDB._config,
87 ) = pytestPDB._saved.pop()
88
89 config.add_cleanup(fin)
90
91
92class pytestPDB:

Callers

nothing calls this directly

Calls 6

PdbTraceClass · 0.85
PdbInvokeClass · 0.85
registerMethod · 0.80
appendMethod · 0.80
add_cleanupMethod · 0.80
getvalueMethod · 0.45

Tested by

no test coverage detected