Add semantic-index service, deployment assets, and tests
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
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()
|
||||
Reference in New Issue
Block a user