Files
redmine/tests/semantic_index/test_cli.py
T
2026-05-04 09:50:03 -04:00

38 lines
1.2 KiB
Python

import subprocess
import sys
from pathlib import Path
from tempfile import TemporaryDirectory
import unittest
from semantic_index.config import load_settings
class SemanticIndexCliTest(unittest.TestCase):
def test_help_does_not_require_http_runtime_dependencies(self):
result = subprocess.run(
[sys.executable, "-m", "semantic_index", "--help"],
check=False,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
text=True,
)
self.assertEqual("", result.stderr)
self.assertEqual(0, result.returncode)
self.assertIn("--mcp-stdio", result.stdout)
def test_settings_load_from_package_env_when_root_env_missing(self):
with TemporaryDirectory() as tmp:
env_path = Path(tmp) / "semantic_index" / ".env"
env_path.parent.mkdir()
env_path.write_text("QDRANT_URL=http://qdrant.example:6333\nREDMINE_SAMPLE_LIMIT=7\n", encoding="utf-8")
settings = load_settings(Path(tmp) / ".env")
self.assertEqual("http://qdrant.example:6333", settings.qdrant_url)
self.assertEqual(7, settings.sample_limit)
if __name__ == "__main__":
unittest.main()