Use `.is_debug_mode()` for maybe-crash-handling

Such that the default is `None` and in the case where the caller *does
not* set the `pdb` arg to an explicit `bool` we instead determine it via
the output from `._state.is_debug_mode()` allowing for more "nonchalant"
usage throughout a (test) code base which passes the `debug_mode: bool`
as runtime config; allows delegation to the per-actor proc-global state.
pytest_pluginize
Tyler Goodlet 2025-05-05 16:03:03 -04:00
parent 1d54096379
commit 0ccf83d520
1 changed files with 5 additions and 1 deletions

View File

@ -3280,7 +3280,7 @@ def open_crash_handler(
@cm
def maybe_open_crash_handler(
pdb: bool = False,
pdb: bool|None = None,
tb_hide: bool = True,
**kwargs,
@ -3291,7 +3291,11 @@ def maybe_open_crash_handler(
Normally this is used with CLI endpoints such that if the --pdb
flag is passed the pdb REPL is engaed on any crashes B)
'''
if pdb is None:
pdb: bool = _state.is_debug_mode()
__tracebackhide__: bool = tb_hide
rtctx = nullcontext(