"""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")