Repository navigation
test: keep the developer's user-wide config out of every test - #486
Merged
HananKavitzAmat merged 1 commit intoNov 8, 2026
Merged
Conversation
Config() merges the first file among get_global_config_candidates()
(~/.config/chunkhound/chunkhound.json and friends). A test that builds a
Config without an embedding section therefore inherits whatever provider
the machine is configured with. On a machine whose global config selects
voyageai with the key supplied by VOYAGE_API_KEY, 47 realtime tests error
and 21 fail in EmbeddingProviderFactory ("Missing: api_key"). With chunkhound#453
applied and the key set, the same tests instead build a real Voyage
provider. Neither happens in CI, which has no global config.
A session-scoped autouse fixture pins CHUNKHOUND_GLOBAL_CONFIG_FILE to an
existing empty file, so the global layer is empty for every test. Tests
that exercise global-config discovery already set or delete the variable
themselves (remote_config's _isolate, clean_environment,
test_config_integration).
Realtime set on Windows with that global config: 21 failed / 71 passed /
34 skipped / 47 errors before, 139 passed / 34 skipped after. The config
tests fail the same 5 tests with and without the fixture.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Collaborator
|
looks good |
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
Config()merges the first file it finds amongConfig.get_global_config_candidates()(~/.config/chunkhound/chunkhound.jsonand the others). A test that builds aConfigwithout anembeddingsection therefore inherits whatever embedding provider the developer's machine is configured with.On a machine whose global config selects
voyageaiand supplies the key throughVOYAGE_API_KEY, the realtime tests that callcreate_servicesfail inEmbeddingProviderFactory.create_provider:With the key exported, #453 fills it in and the same tests build a real Voyage provider instead. Neither happens in CI, which has no global config, so the suite passes there and fails (or reaches a paid API) on a configured developer machine.
Fix
A session-scoped autouse fixture in
tests/conftest.pypinsCHUNKHOUND_GLOBAL_CONFIG_FILEto an existing empty{}file, so the global layer is empty for every test, as it is in CI. Tests that exercise global-config discovery already set or delete the variable themselves (tests/remote_config/conftest.py's_isolate,clean_environment,test_config_integration.py), so they are unaffected.I changed the tests, not config resolution: reading the user-wide config is correct product behaviour, and the leak is that the tests depend on the machine they run on.
Evidence
Windows 11, Python 3.13, this branch, global config selecting
voyageai,VOYAGE_API_KEYunset, realtime set (tests/realtime+tests/test_realtime_*.py):api_keyerrors)tests/test_config*.py+tests/remote_configfail the same 5 tests with and without the fixture (pre-existing on Windows).🤖 Generated with Claude Code