Spaces:
Running
Running
| """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 | |