Skip to content

fix: isolate bad-token tests from the module-wide test dir - #208

Merged
dwilding merged 1 commit into
mainfrom
fix-repo-url
Oct 27, 2026
Merged

dwilding merged 1 commit into
mainfrom
fix-repo-url

Conversation

@dwilding

Copy link
Copy Markdown
Owner

Problem

The full functional tests fail on push to main (example run): test_bad_token_no_owner and test_bad_token_no_upstream_owner fail with assert (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 whenever GITHUB_TOKEN is set, and clones jubilant/dwilding-my-feature into the module-scoped test_dir.

Reproduced locally: GITHUB_TOKEN=<token> pytest tests/functional/test_token.py fails both, while bad-token tests alone pass.

Fix

The bad-token tests now use a function-scoped fresh_dir fixture — 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 pass
  • full lint (ruff, ty), unit tests (57 pass): pass
  • The full-suite run found 3 unrelated local failures (2 jumbo tests both fail identically on clean main; one transient) — pre-existing, not caused by this change.

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>
@dwilding
dwilding merged commit f77931b into main Oct 27, 2026
14 checks passed
@dwilding
dwilding deleted the fix-repo-url branch October 27, 2026 12:53
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