tests: isolate the home directory for the whole suite - #111
Merged
Merged
Conversation
Two install tests loop over every adapter with a repo_root under tmp_path,
but junie and kimi_code keep their config under `~`, so install() correctly
expanded `~` and wrote a hook entry into the developer's real ~/.junie and
~/.kimi-code. The junie-specific tests further down already moved HOME; the
loops did not.
An autouse fixture in conftest.py now points every home variable at a
per-test directory, so the next home-anchored vendor cannot leak the same
way. It sets USERPROFILE and HOMEDRIVE + HOMEPATH as well as HOME, since
ntpath.expanduser never reads HOME and the existing per-test setenv("HOME")
calls were leaving the Windows profile unprotected.
Closes #110.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Signed-off-by: Claude <noreply@anthropic.com>
jothimani-rajendran
marked this pull request as ready for review
September 7, 2026 18:27
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.
What this changes
Running the suite no longer writes into the developer's real
~/.junie/config.jsonand~/.kimi-code/config.toml. Closes #110.Two tests in
tests/test_install.pyloop over every adapter with arepo_rootundertmp_path, but junie and kimi_code keep their config under~, soinstall()correctly expanded~and wrote a marked hook entry into the real home. A new autouse fixture intests/conftest.pypoints every home variable at a per-test directory. It setsUSERPROFILEandHOMEDRIVE+HOMEPATHas well asHOME, becausentpath.expandusernever readsHOME, so the existing per-testmonkeypatch.setenv("HOME", ...)calls were leaving the Windows profile unprotected too.No
src/change. Productioninstallbehaves exactly as its config path says.Checks
pytest -qpasses: 1523 passed, 4 skipped (3.11); 1521 passed, 6 skipped (3.10). Before each run~/.junieand~/.kimi-codewere deleted, and after each run neither exists.ruff check .andruff format --check .passtests/check_stdlib_only.pypasses)git commit -s)Notes for the reviewer
The fixture returns the home path, so a test that wants to assert on a user-scoped file can take
isolated_homeas an argument instead of re-deriving it. No existing test was changed; the per-testsetenv("HOME")calls still work and now merely repeat what the fixture did.🤖 Generated with Claude Code
Generated by Claude Code