test: run pytest in CI — real unit job + Qdrant-backed integration job #52

Merged
jcabillot merged 10 commits from tests/ci-pytest into main 2026-10-09 15:53:53 -04:00
3 changed files with 25 additions and 9 deletions
Showing only changes of commit 679d72288f - Show all commits

No files matched your search

+15
View File
@@ -0,0 +1,15 @@
"""Shared test configuration — sets env vars ONCE before any test module runs.
The env must be consistent for the whole pytest session: server.py freezes
COLLECTION_NAME/QDRANT_URL at import time, while the integration fixture
reads os.environ at fixture time. If any test module mutates os.environ after
that (test_server.py used to set COLLECTION_NAME='test'), the fixture creates
a different collection than the one server functions query → 404.
Keep all env wiring here so import order no longer matters.
"""
import os
os.environ.setdefault("QDRANT_URL", "http://localhost:6333")
os.environ.setdefault("COLLECTION_NAME", "test_mcp_maildir")
os.environ.setdefault("EMBEDDING_MODEL_NAME", "BAAI/bge-small-en-v1.5")
+6 -5
View File
@@ -1,13 +1,14 @@
"""Integration tests for mcp-maildir with a real Qdrant instance."""
"""Integration tests for mcp-maildir with a real Qdrant instance.
Env vars (QDRANT_URL, COLLECTION_NAME, EMBEDDING_MODEL_NAME) are set in
tests/conftest.py — don't set them here, they must match server.py's
import-time snapshot for every module in the session.
"""
import os
import uuid
import pytest
os.environ["QDRANT_URL"] = "http://localhost:6333"
os.environ["COLLECTION_NAME"] = "test_mcp_maildir"
os.environ["EMBEDDING_MODEL_NAME"] = "BAAI/bge-small-en-v1.5"
from server import get_qdrant_client, get_embedding_model, search_emails, read_email
from qdrant_client.http import models
+4 -4
View File
@@ -1,8 +1,8 @@
"""Unit tests for mcp-maildir server pure functions."""
"""Unit tests for mcp-maildir server pure functions.
import os
os.environ["QDRANT_URL"] = "http://localhost:6333"
os.environ["COLLECTION_NAME"] = "test"
Env vars are set in tests/conftest.py (shared session-wide) — see the
conftest docstring for why test modules must not touch os.environ.
"""
from server import (
normalize_email_address,