File size: 683 Bytes
ede7942 | 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 | """
pytest configuration: stub out heavy ML libraries before importing the app,
so tests can run without torch / transformers / sentencepiece installed.
"""
import sys
from unittest.mock import MagicMock
# ── Stub heavy ML / native libraries ─────────────────────────────────────────
_STUBS = [
"torch",
"numpy",
"numpy.linalg",
"transformers",
"transformers.pipelines",
"sentencepiece",
"accelerate",
"sklearn",
"sklearn.metrics",
"sklearn.metrics.pairwise",
]
for _mod in _STUBS:
if _mod not in sys.modules:
sys.modules[_mod] = MagicMock()
|