test(config): use UTF-8 for migration fixtures on Windows

This commit is contained in:
chengyongru authored and chengyongru committed 2026-10-10 01:33:02 +08:00
1 parent 432c044f8e
commit 2790521af8
2 files changed
+3 -3

No files matched your search

+2 -2
View File
@@ -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
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)
expected = None if legacy == "auto" else {
"supportedApis": [legacy], "preferredApi": legacy,
}
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 field not in saved # The seeded legacy field must not survive a save.
assert load_config(path).providers.openai.api == config.providers.openai.api
+1 -1
View File
@@ -466,7 +466,7 @@ async def test_migrated_openai_default_routes_and_allows_model_override(bind_tra
config_path.write_text(json.dumps({
"providers": {"openai": {"apiKey": "fixture", "apiType": legacy}},
"agents": {"defaults": {"model": "gpt-4o", "provider": "openai"}},
}))
}), encoding="utf-8")
config = load_config(config_path)
save_config(config, config_path)
config = load_config(config_path)