Complete PR review feedback implementation with clean importlib.resources approach
- Remove redundant path checks between Path("conf/custom_models.json") and Path.cwd() variants
- Implement proper importlib.resources.files('conf') approach for robust packaging
- Create conf/__init__.py to make conf a proper Python package
- Update pyproject.toml to include conf* in package discovery
- Clean up verbose comments and simplify resource loading logic
- Fix test mocking to use correct importlib.resources.files target
- All tests passing (8/8) with proper resource and fallback functionality
Addresses all gemini-code-assist bot feedback from PR #227
This commit is contained in:
@@ -53,7 +53,7 @@ class TestUvxPathResolution:
|
||||
assert registry.config_path == config_path
|
||||
assert len(registry.list_models()) > 0
|
||||
|
||||
@patch("providers.openrouter_registry.files")
|
||||
@patch("providers.openrouter_registry.importlib.resources.files")
|
||||
@patch("pathlib.Path.exists")
|
||||
def test_multiple_path_fallback(self, mock_exists, mock_files):
|
||||
"""Test that multiple path resolution works for different deployment scenarios."""
|
||||
@@ -70,7 +70,7 @@ class TestUvxPathResolution:
|
||||
assert not registry.use_resources, "Should fall back to file system when resources fail"
|
||||
|
||||
# Assert that the registry fell back to the second potential path
|
||||
assert registry.config_path == Path("conf/custom_models.json")
|
||||
assert registry.config_path == Path.cwd() / "conf" / "custom_models.json"
|
||||
|
||||
# Should load models successfully
|
||||
assert len(registry.list_models()) > 0
|
||||
|
||||
Reference in New Issue
Block a user