Universal run: trace any Python entry point, not only pytest#89
Open
AnshBajpai05 wants to merge 1 commit into
Open
Universal run: trace any Python entry point, not only pytest#89AnshBajpai05 wants to merge 1 commit into
AnshBajpai05 wants to merge 1 commit into
Conversation
oracletrace run now dispatches pytest, python <script.py>, python -m <module>, and bare <script.py> / -m shorthands — all in-process (runpy / pytest.main), because sys.setprofile only observes the current process and a subprocess would silently produce an empty trace. Non-Python commands and python -c are rejected with an error explaining that constraint. New oracletrace/runner.py owns dispatch; cli.py's run handler shrinks to init-tracer -> execute_command -> report. Script exit codes propagate as in KaykCaputo#87. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Owner
|
Pipeline failing |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
First feature slice from the roadmap we agreed on in #80: universal
run.What it does —
oracletrace runnow accepts any Python entry point, not only pytest:All existing flags (
--json,--csv,--html,--compare,--fail-on-regression,--repeat, …) work unchanged; the script's ownsys.exitcode is propagated the same way #87 does for target mode (gate codes still win).Design — everything executes in-process (
runpy.run_path/runpy.run_module/pytest.main):sys.setprofileonly observes the current process, so a subprocess would silently produce an empty trace. That's also why non-Python commands (node,cargo, …) andpython -care rejected with an error that explains the constraint instead of returning empty results.Launcher detection handles the common spellings (
python,python3,python3.12,py,python.exe, full paths).sys.argvandsys.pathare patched around the run and restored after, mirroring what the real interpreter invocation would look like to the target (argv[0], script dir / cwd importability).Structure — new
oracletrace/runner.pyowns command dispatch;cli.py'srunhandler shrinks to init-tracer →execute_command()→ report. The pytest-only_run_pytestincli.pyis superseded (its behavior, including the "pytest is not installed" message, moved into the runner).Tests — 27 new: every supported form e2e (script,
python script,-m,python -m, pytest), argv passing, exit-code propagation,--jsonexport underrun, rejection paths (non-Python binary,python -c, barepython, missing script), launcher-detection unit tests, argv-restoration check. One existing test updated (test_run_unsupported_command) since the arbitrary-command rejection message changed — that's the intended behavior change.🤖 Generated with Claude Code