Spaces:
Runtime error
Runtime error
File size: 888 Bytes
ad51766 | 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 28 29 30 | """Pytest config: ensure repo root is on sys.path and stub external deps."""
from __future__ import annotations
import os
import sys
import types
from pathlib import Path
ROOT = Path(__file__).resolve().parent.parent
if str(ROOT) not in sys.path:
sys.path.insert(0, str(ROOT))
# config.py instantiates an OpenAI client at import time. Provide a key so it
# doesn't yell about a missing one during collection.
os.environ.setdefault("HY_API_KEY", "test-key")
# Stub gradio for pure-logic tests so we don't need the heavy dependency just
# to import modules that touch ``gr.Warning`` / ``gr.update`` at module scope.
if "gradio" not in sys.modules:
gradio_stub = types.ModuleType("gradio")
def _noop(*_args, **_kwargs):
return None
gradio_stub.Warning = _noop
gradio_stub.Info = _noop
gradio_stub.update = _noop
sys.modules["gradio"] = gradio_stub
|