Repository navigation
fix: isolate bad-token tests from the module-wide test dir - #208
Merged
Merged
Conversation
The bad-token tests assert that nothing is created on disk when the token is rejected. That assertion only holds in a fresh dir, but they shared the module-scoped test_dir fixture with test_forked_repo_token, which clones jubilant/ before they run whenever a GITHUB_TOKEN is set. The full functional tests therefore failed on push to main (though PR runs pass, because they skip the token tests and leave the shared dir empty). Give the bad-token tests a function-scoped fresh_dir fixture so each gets a dir no other test has touched. Restore the "nothing exists" assertion reverted in #207 (its "or empty" relaxation assumed gimmegit itself could create the dir, but a rejected token always exits before cloning starts). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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.
Problem
The full functional tests fail on push to main (example run):
test_bad_token_no_ownerandtest_bad_token_no_upstream_ownerfail withassert (not True or not True)—jubilant/exists and is non-empty in the shared test dir.The failing tests assert that nothing is created on disk when the CLI rejects a bad token. But exam of the CLI flow (get_context) shows a rejected token always exits before creating the clone dir. The dir was polluted by
test_forked_repo_token, which runs first wheneverGITHUB_TOKENis set, and clonesjubilant/dwilding-my-featureinto the module-scopedtest_dir.Reproduced locally:
GITHUB_TOKEN=<token> pytest tests/functional/test_token.pyfails both, while bad-token tests alone pass.Fix
The bad-token tests now use a function-scoped
fresh_dirfixture — a dir no other test has touched. This also restores the strict "nothing exists" assertion, reverting #207's "or empty" relaxation, which assumed the CLI might create the dir itself — a wrong theory; no file is created before the token check.The bump workflow 403 (the other recent failure) is a GitHub token permissions issue and stays out of scope here.
Validation
GITHUB_TOKEN=<token> uv run pytest tests/functional/test_token.py: 6/6 pass (CI-equivalent scenario; previously 2 failed)uv run pytest tests/functional -q: bad-token tests passruff,ty), unit tests (57 pass): pass