fix(adapter,tests): isolate _load_providers tests from multi-path lookup #8
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "fix/load-providers-tests-isolate-multipath"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Why
The 5
_load_providerstests intest_adapter_prevalidate.pyare single-path-only: they write a config.yaml totmp_pathand call_load_providers(str(tmp_path)), expecting it to readtmp_path/config.yaml. After the multi-path fix in #7, the function also checks the template-bundled and canonical paths; path 2 finds the repo's ownconfig.yamlon the test runner's disk and returns the 7 bundled providers, breaking 5 tests.Changes
adapter.py: extractos.path.dirname(os.path.abspath(__file__))into a module-level_TEMPLATE_DIRconstant, mirroring_CANONICAL_ADAPTER_DIR. Production behavior identical — resolved once at import time. Tests can nowmonkeypatch.setattr(adapter, '_TEMPLATE_DIR', ...)to redirect path 2.tests/test_adapter_prevalidate.py: 5_load_providerstests now monkeypatch both_CANONICAL_ADAPTER_DIRand_TEMPLATE_DIRto a non-existent tmp subdir, isolating to the workspaceconfig_pathbranch they always meant to test.The 6th test (
test_load_providers_parses_yaml_and_normalizes) already passed because path 2 returns 7 providers and that's what it expects. Unchanged.Verification
🤖 Generated with Claude Code
LGTM. Right fix shape: extract _TEMPLATE_DIR to module level so tests can pin it. 65/65 pass.