Skip to content

[Other] test_abort_sync finds the serve package under unittest discovery - #241

Open
okada-shogo wants to merge 1 commit into
simplexai-labs:mainfrom
okada-shogo:port/fix-ci-abort-sync
Open

okada-shogo wants to merge 1 commit into
simplexai-labs:mainfrom
okada-shogo:port/fix-ci-abort-sync

Conversation

@okada-shogo

Copy link
Copy Markdown

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.py sorts first, before any test that puts terminal/ on sys.path, so its import fails:

ModuleNotFoundError: No module named 'serve'

After this change the test imports and the full workflow command passes.

Related discussion

none

Approach

test_abort_sync.py inserts terminal/ on sys.path before from serve import server, the same way test_anthropic_base_url.py and test_cut_arguments.py already 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).
  • Linux x86-64, Python from the repo venv.

Failed:
none

Not run:

  • The GitHub-hosted runner itself (it will run on this PR).
  • Windows and macOS.

Limits

Other tests still rely on import order. About 100 test files in terminal/serve import serve without a path insert (for example test_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

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>
@okada-shogo

Copy link
Copy Markdown
Author

A note for whoever looks at the workflow: while checking this I found that 102 test files in terminal/serve import serve without putting terminal/ on sys.path themselves. Under unittest discover -s terminal/serve they only pass because an earlier file in alphabetical order (now test_abort_sync.py, also test_admit_order.py) has already inserted it; run on its own, for example -p test_answer_speed.py, test_appendlog.py or test_bool_args.py, each fails with the same ModuleNotFoundError.

This PR keeps to the one file that breaks CI today. A sturdier fix would be one line in .github/workflows/terminal-minimal-server.yml: pass the top-level directory, python -m unittest discover -s terminal/serve -t terminal -p 'test_*.py', so serve is importable from the start regardless of order. Happy to send that as a separate PR if you'd like it.

okada-shogo added a commit to okada-shogo/PolyStrata that referenced this pull request Nov 23, 2026
…kage under unittest discovery

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant