[CI/Build] Do not abort test collection when pexpect is missing - #110
Open
GuoCheng24 wants to merge 1 commit into
Open
[CI/Build] Do not abort test collection when pexpect is missing#110GuoCheng24 wants to merge 1 commit into
GuoCheng24 wants to merge 1 commit into
Conversation
tests/test_tui_e2e.py imports pexpect at module level, before the skipif mark below it. pexpect is not declared in pyproject.toml, install.sh or uv.lock, so on a clean checkout the 'pytest' command in CONTRIBUTING.md fails collection of the whole suite instead of skipping this one file. Use importorskip and declare the test-only dependencies in a dev extra.
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.
CONTRIBUTING.mdsays to run tests withpytest. On a clean checkout that aborts before collecting anything:pexpectis declared nowhere — not inpyproject.tomldependencies or extras, not ininstall.sh, not inuv.lock. Neither ispytestitself. The file was clearly meant to be skippable: line 23 ispytestmark = pytest.mark.skipif(shutil.which("script") is None, ...). But that mark is evaluated after the module import, so the import takes the whole suite down instead of skipping this one file — 56 test files for one optional dependency.The change.
pexpect = pytest.importorskip("pexpect"), which skips this module and leaves the rest of the suite collecting, plus adevextra declaring the test-only dependencies.Verified both directions with
pexpectblocked at import:AI assistance: partial — the reproduction, the fix and the before/after verification were done by running pytest with the import blocked on a clean venv, then confirming the rest of the suite still collects.