-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from lukasrump/add-code-loader-argument
feat: add code loader argument
- Loading branch information
Showing
4 changed files
with
72 additions
and
11 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import pytest | ||
from crllm.config.config_service import ConfigService | ||
|
||
|
||
@pytest.fixture() | ||
def mock_config_file(tmpdir): | ||
tmpdir.join("config.toml").write( | ||
""" | ||
[crllm] | ||
loader = "foo" | ||
provider = "bar" | ||
""" | ||
) | ||
|
||
return str(tmpdir.join("config.toml")) | ||
|
||
|
||
def test_get_config(mock_config_file): | ||
config_service = ConfigService() | ||
config_service.set_config_path(mock_config_file) | ||
|
||
result = config_service.get_config() | ||
|
||
assert result["crllm"]["loader"] == "foo" | ||
assert result["crllm"]["provider"] == "bar" | ||
|
||
|
||
def test_override(mock_config_file): | ||
config_service = ConfigService() | ||
config_service.set_config_path(mock_config_file) | ||
|
||
config_service.override_config({"crllm": {"loader": "test"}}) | ||
|
||
result = config_service.get_config() | ||
|
||
assert result["crllm"]["loader"] == "test" |