Skip to content

Commit fa5fd45

Browse files
rchiodoflub
authored andcommitted
Add support sys.monitoring
1 parent 3d41ba8 commit fa5fd45

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

pytest_timeout.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,10 @@ def is_debugging(trace_func=None):
290290
for name in KNOWN_DEBUGGING_MODULES:
291291
if any(part.startswith(name) for part in parts):
292292
return True
293+
294+
# For 3.12, sys.monitoring is used for tracing. Check if any debugger has been registered.
295+
if hasattr(sys, "monitoring"):
296+
return sys.monitoring.get_tool(sys.monitoring.DEBUGGER_ID) != None
293297
return False
294298

295299

0 commit comments

Comments
 (0)