Lucas
Add llama.cpp parser backend for Space
95cf15d
Raw
History Blame Contribute Delete
1.1 kB
import os
import tempfile
import unittest
from pathlib import Path
from unittest.mock import patch
from training_coach.env import load_local_env
class EnvTests(unittest.TestCase):
def test_load_local_env_sets_missing_values_without_overriding_existing(self):
with tempfile.TemporaryDirectory() as temp_dir:
env_path = Path(temp_dir) / ".env"
env_path.write_text(
"\n".join(
[
"# comment",
"PARSER_BACKEND=llama_cpp",
"OLLAMA_MODEL='qwen3:1.7B'",
"EXISTING=value-from-file",
]
)
)
with patch.dict(os.environ, {"EXISTING": "value-from-env"}, clear=True):
load_local_env(env_path)
self.assertEqual(os.environ["PARSER_BACKEND"], "llama_cpp")
self.assertEqual(os.environ["OLLAMA_MODEL"], "qwen3:1.7B")
self.assertEqual(os.environ["EXISTING"], "value-from-env")
if __name__ == "__main__":
unittest.main()