-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconftest.py
More file actions
27 lines (21 loc) · 944 Bytes
/
conftest.py
File metadata and controls
27 lines (21 loc) · 944 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
"""Root-level pytest configuration.
Responsibilities:
- Ensure the DataLab project root is importable (mirrors ``tests/conftest.py``
so tests can run from anywhere).
- Set ``DATALAB_DEBUG`` during test runs so ``app_web.server.create_app()``
resolves a random-per-process SECRET_KEY without requiring an explicit
``DATALAB_WEB_SECRET``. This keeps the test suite hermetic while preserving
the production invariant that a missing secret is a hard failure.
"""
from __future__ import annotations
import os
import sys
from pathlib import Path
ROOT = Path(__file__).resolve().parent
if str(ROOT) not in sys.path:
sys.path.insert(0, str(ROOT))
# Mark this process as a development/test context so create_app generates a
# random SECRET_KEY instead of raising. Tests that specifically exercise the
# production refusal path still patch os.environ with `clear=True` to remove
# this flag.
os.environ.setdefault("DATALAB_DEBUG", "1")