From 2790521af87077d7778cecc86f61cfc5244de2b1 Mon Sep 17 00:00:00 2001 From: chengyongru Date: Fri, 9 Oct 2026 16:18:52 +0800 Subject: [PATCH] test(config): use UTF-8 for migration fixtures on Windows --- tests/config/test_model_presets.py | 4 ++-- tests/providers/test_model_api_presets.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/config/test_model_presets.py b/tests/config/test_model_presets.py index b4413a1bf..faa0aa8ac 100644 --- a/tests/config/test_model_presets.py +++ b/tests/config/test_model_presets.py @@ -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 diff --git a/tests/providers/test_model_api_presets.py b/tests/providers/test_model_api_presets.py index ca06af2db..22c6a2291 100644 --- a/tests/providers/test_model_api_presets.py +++ b/tests/providers/test_model_api_presets.py @@ -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)