MCPcopy Create free account
hub / github.com/pytest-dev/pytest / pytest_configure

Function pytest_configure

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

Source from the content-addressed store, hash-verified

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