test(config): use UTF-8 for migration fixtures on Windows
This commit is contained in:
1 parent
432c044f8e
commit
2790521af8
2 files changed
+3
-3
No files matched your search
@@ -78,13 +78,13 @@ def test_legacy_provider_api_migrates_and_saves_current_format(tmp_path, field,
|
|||||||
from nanobot.config.loader import load_config, save_config
|
from nanobot.config.loader import load_config, save_config
|
||||||
|
|
||||||
path = tmp_path / "config.json"
|
path = tmp_path / "config.json"
|
||||||
path.write_text(json.dumps({"providers": {"openai": {"apiKey": "sk-test", field: legacy}}}))
|
path.write_text(json.dumps({"providers": {"openai": {"apiKey": "sk-test", field: legacy}}}), encoding="utf-8")
|
||||||
config = load_config(path)
|
config = load_config(path)
|
||||||
expected = None if legacy == "auto" else {
|
expected = None if legacy == "auto" else {
|
||||||
"supportedApis": [legacy], "preferredApi": legacy,
|
"supportedApis": [legacy], "preferredApi": legacy,
|
||||||
}
|
}
|
||||||
save_config(config, path)
|
save_config(config, path)
|
||||||
saved = json.loads(path.read_text())["providers"]["openai"]
|
saved = json.loads(path.read_text(encoding="utf-8"))["providers"]["openai"]
|
||||||
assert saved.get("api") == expected
|
assert saved.get("api") == expected
|
||||||
assert field not in saved # The seeded legacy field must not survive a save.
|
assert field not in saved # The seeded legacy field must not survive a save.
|
||||||
assert load_config(path).providers.openai.api == config.providers.openai.api
|
assert load_config(path).providers.openai.api == config.providers.openai.api
|
||||||
|
|||||||
@@ -466,7 +466,7 @@ async def test_migrated_openai_default_routes_and_allows_model_override(bind_tra
|
|||||||
config_path.write_text(json.dumps({
|
config_path.write_text(json.dumps({
|
||||||
"providers": {"openai": {"apiKey": "fixture", "apiType": legacy}},
|
"providers": {"openai": {"apiKey": "fixture", "apiType": legacy}},
|
||||||
"agents": {"defaults": {"model": "gpt-4o", "provider": "openai"}},
|
"agents": {"defaults": {"model": "gpt-4o", "provider": "openai"}},
|
||||||
}))
|
}), encoding="utf-8")
|
||||||
config = load_config(config_path)
|
config = load_config(config_path)
|
||||||
save_config(config, config_path)
|
save_config(config, config_path)
|
||||||
config = load_config(config_path)
|
config = load_config(config_path)
|
||||||
|
|||||||
Reference in new issue
Block a user