Repository navigation
[Other] test_abort_sync finds the serve package under unittest discovery - #241
okada-shogo wants to merge 1 commit into
Conversation
The minimal serving runtime workflow runs `unittest discover -s terminal/serve`. test_abort_sync sorts first, before any test that puts terminal/ on sys.path, so its `from serve import server` failed with ModuleNotFoundError and the job went red on main (d1f711e) and on every PR. It now inserts terminal/ on sys.path the way test_anthropic_base_url and test_cut_arguments already do. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
A note for whoever looks at the workflow: while checking this I found that 102 test files in This PR keeps to the one file that breaks CI today. A sturdier fix would be one line in |
…kage under unittest discovery Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Problem and result
The "Minimal serving runtime" job is red on main (run 45053907296 on d1f711e) and so on every PR. The workflow runs
python -m unittest discover -s terminal/serve -p 'test_*.py'.test_abort_sync.pysorts first, before any test that putsterminal/onsys.path, so its import fails:After this change the test imports and the full workflow command passes.
Related discussion
none
Approach
test_abort_sync.pyinsertsterminal/onsys.pathbeforefrom serve import server, the same waytest_anthropic_base_url.pyandtest_cut_arguments.pyalready do.Validation
Passed:
python -m unittest discover -s terminal/serve -p 'test_abort_sync.py'on d1f711e:ModuleNotFoundError: No module named 'serve'(reproduces the CI error); on this branch:Ran 3 tests ... OK.python -m unittest discover -s terminal/serve -p 'test_*.py'on this branch:Ran 2321 tests in 897s, OK (skipped=90).Failed:
none
Not run:
Limits
Other tests still rely on import order. About 100 test files in
terminal/serveimportservewithout a path insert (for exampletest_answer_speed.py,test_appendlog.py,test_bool_args.py). They pass under the workflow command because an earlier test sets the path, but fail when run alone with-p <file>. This PR does not change them.🤖 Generated with Claude Code