21 lines
952 B
Python
21 lines
952 B
Python
# conftest.py at backend root
|
|
# Prevents pytest collection errors caused by duplicate test module names
|
|
# between the root tests/ directory and co-located src/<module>/__tests__/ directories.
|
|
# Without this, pytest sees e.g. tests/test_auth.py and src/core/auth/__tests__/test_auth.py
|
|
# and raises "import file mismatch" because both map to module name "test_auth".
|
|
|
|
import os
|
|
from cryptography.fernet import Fernet
|
|
|
|
# Set ENCRYPTION_KEY for EncryptionManager before any module imports
|
|
# Required by LLMProviderService which is imported via route modules
|
|
os.environ.setdefault("ENCRYPTION_KEY", Fernet.generate_key().decode())
|
|
|
|
# Files in tests/ that clash with __tests__/ co-located tests.
|
|
# norecursedirs=["__tests__"] in pyproject.toml prevents collection from src/__tests__/
|
|
# at the directory level; this list handles edge cases where explicit file paths
|
|
# are collected.
|
|
collect_ignore = [
|
|
os.path.join("tests", "schemas", "test_auth.py"),
|
|
]
|