From 25c885ae0b342d3c24c8d4cee4c258456277d4cd Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 24 Apr 2026 23:08:26 +0000 Subject: [PATCH] test: use tmp_path for embedding device config tests Agent-Logs-Url: https://github.com/MemPalace/mempalace/sessions/3213a67a-6871-4bb2-9ae0-23fa11001a22 Co-authored-by: igorls <4753812+igorls@users.noreply.github.com> --- tests/test_config.py | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/tests/test_config.py b/tests/test_config.py index 8d020f9..c2b537a 100644 --- a/tests/test_config.py +++ b/tests/test_config.py @@ -25,22 +25,20 @@ def test_embedding_device_defaults_to_auto(): assert cfg.embedding_device == "auto" -def test_embedding_device_from_config_is_normalized(): - tmpdir = tempfile.mkdtemp() - with open(os.path.join(tmpdir, "config.json"), "w") as f: +def test_embedding_device_from_config_is_normalized(tmp_path): + with open(tmp_path / "config.json", "w") as f: json.dump({"embedding_device": " CUDA "}, f) - cfg = MempalaceConfig(config_dir=tmpdir) + cfg = MempalaceConfig(config_dir=str(tmp_path)) assert cfg.embedding_device == "cuda" -def test_embedding_device_env_overrides_config(): - tmpdir = tempfile.mkdtemp() - with open(os.path.join(tmpdir, "config.json"), "w") as f: +def test_embedding_device_env_overrides_config(tmp_path): + with open(tmp_path / "config.json", "w") as f: json.dump({"embedding_device": "cpu"}, f) os.environ["MEMPALACE_EMBEDDING_DEVICE"] = " CoreML " try: - cfg = MempalaceConfig(config_dir=tmpdir) + cfg = MempalaceConfig(config_dir=str(tmp_path)) assert cfg.embedding_device == "coreml" finally: del os.environ["MEMPALACE_EMBEDDING_DEVICE"]