29 lines
1.3 KiB
Python
29 lines
1.3 KiB
Python
"""Test-suite defaults that must be set before any test module is imported.
|
|
|
|
`main.py` builds the entire runtime at module scope (`build_runtime(get_settings())`),
|
|
and `tests/test_api.py` imports `main`. With the default `EMBEDDING_PROVIDER=cohere-v4`
|
|
— or with a developer's `.env` selecting it — that construction opens a
|
|
`QdrantClient` and calls `get_collections()` for the corpus-manifest check, so
|
|
`pytest` fails during *collection* on any machine without a reachable Qdrant:
|
|
|
|
qdrant_client.http.exceptions.ResponseHandlingException:
|
|
[WinError 10061] No connection could be made ...
|
|
Interrupted: 1 error during collection
|
|
|
|
No unit test needs a live datastore: every test injects its own doubles, and
|
|
the one suite that does need real services (`test_live_datastores.py`) gates
|
|
itself behind `RUN_INTEGRATION=1`. Forcing the disabled provider here makes
|
|
`pytest tests -q` work out of the box instead of requiring an undocumented
|
|
environment variable.
|
|
|
|
`setdefault`, not assignment: a deliberate override (for example
|
|
`EMBEDDING_PROVIDER=cohere-v4 pytest ...` against a local Qdrant) still wins.
|
|
|
|
This runs at import time, before pytest collects any module, which is the only
|
|
point early enough — `config.get_settings()` is `lru_cache`d, so a fixture
|
|
would already be too late.
|
|
"""
|
|
import os
|
|
|
|
os.environ.setdefault("EMBEDDING_PROVIDER", "disabled")
|