Skip to content

Commit 6269e1f

Browse files
committed
ISSUE-007: Add failing test for disabling tracing on callback error
- Simulate `sys._getframe` failure during `PY_START` and assert initial error surfaces. - Re-run the same program path to ensure tracer disables after the first error. - Test currently fails, exposing repeated callback errors (tracer remains active).
1 parent 79b344c commit 6269e1f

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

codetracer-python-recorder/tests/test_fail_fast_on_py_start.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,13 @@ def boom(*_args, **_kwargs): # pragma: no cover - intentionally fails
3737

3838
# Ensure the error surfaced clearly and didn’t get swallowed
3939
assert "_getframe" in str(excinfo.value) or "boom" in str(excinfo.value)
40+
41+
# After the first failure, tracing must be disabled so
42+
# subsequent Python function calls do not trigger the same error.
43+
# Re-running the same program path should no longer raise.
44+
ns = runpy.run_path(str(prog), run_name="__main__")
45+
assert isinstance(ns, dict)
4046
finally:
4147
# Restore state
4248
sys._getframe = original_getframe # type: ignore[attr-defined]
4349
cpr.stop_tracing()
44-

0 commit comments

Comments
 (0)