Skip to content

fix(tests): exclude root-level scripts from pytest collection (#11)#36

Open
bradsmithmba wants to merge 1 commit into
cloudtrainerwork:masterfrom
bradsmithmba:fix/exclude-root-scripts
Open

fix(tests): exclude root-level scripts from pytest collection (#11)#36
bradsmithmba wants to merge 1 commit into
cloudtrainerwork:masterfrom
bradsmithmba:fix/exclude-root-scripts

Conversation

@bradsmithmba

Copy link
Copy Markdown

Summary

Four root-level files are standalone manual/integration scripts, not pytest test modules:

test_api.py   test_e2e.py   test_installed_api.py   test_options_simple.py

test_api.py (line 48) and test_installed_api.py (lines 67/70) call sys.exit() at module scope. When pytest auto-discovers and imports them during collection, sys.exit raises SystemExit, which aborts collection of the entire suite with INTERNALERROR.

Closes #11.

Fix

Add collect_ignore for the four files in the root conftest.py. They remain in place for manual use (python test_api.py) but are no longer auto-collected.

collect_ignore = [
    "test_api.py", "test_e2e.py",
    "test_installed_api.py", "test_options_simple.py",
]

Verification

BEFORE:  pytest test_api.py --collect-only  ->  INTERNALERROR: SystemExit
AFTER:   bare `pytest --collect-only` collects 0 of the four scripts, no abort

Scope note

A full pytest run still surfaces unrelated collection errors from separately-tracked issues — the missing data layer (#1), the CLI sys.exit at import (#6), and the missing integrated_selector module (#21). This PR removes the root-script class of collection-killer; it does not claim to make the whole suite collectable on its own. Those other PRs/issues handle the rest.

🤖 Generated with Claude Code

Four root-level files — test_api.py, test_e2e.py, test_installed_api.py,
test_options_simple.py — are standalone manual/integration scripts, not
pytest test modules. test_api.py and test_installed_api.py call sys.exit()
at module scope, so pytest importing them during auto-discovery raised
SystemExit and aborted collection of the entire suite (INTERNALERROR).

Add collect_ignore for the four files in the root conftest.py. They stay in
place for manual use (`python test_api.py`) but are no longer auto-collected.

Before: `pytest test_api.py --collect-only` -> INTERNALERROR: SystemExit.
After:  bare discovery collects 0 of the four scripts and does not abort.

Note: a full `pytest` run still hits unrelated collection errors from the
data layer (cloudtrainerwork#1), the CLI sys.exit (cloudtrainerwork#6), and the missing integrated_selector
(cloudtrainerwork#21); those are tracked separately. This change removes the root-script
class of collection-killer.

Closes cloudtrainerwork#11

Co-Authored-By: Claude Opus 4.8 <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.

Root-level test_*.py scripts call sys.exit() at import, corrupting pytest collection

1 participant