Spaces:
Running on Zero
Running on Zero
test: add pytest scaffolding
Browse files- tests/__init__.py +0 -0
- tests/conftest.py +22 -0
tests/__init__.py
ADDED
|
File without changes
|
tests/conftest.py
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Shared pytest fixtures.
|
| 2 |
+
|
| 3 |
+
The default pytest config (pyproject.toml) skips tests marked `gpu`. Opt in
|
| 4 |
+
to GPU smoke tests with `pytest -m gpu`.
|
| 5 |
+
"""
|
| 6 |
+
|
| 7 |
+
from __future__ import annotations
|
| 8 |
+
|
| 9 |
+
import os
|
| 10 |
+
import sys
|
| 11 |
+
from pathlib import Path
|
| 12 |
+
|
| 13 |
+
import pytest
|
| 14 |
+
|
| 15 |
+
# Ensure repo root is importable as flat modules (matches z-image-studio convention).
|
| 16 |
+
sys.path.insert(0, str(Path(__file__).resolve().parent.parent))
|
| 17 |
+
|
| 18 |
+
|
| 19 |
+
@pytest.fixture(autouse=True)
|
| 20 |
+
def _silence_mps_fallback_env(monkeypatch):
|
| 21 |
+
"""L1+L2 tests don't touch torch/mps; clear the env so test logs are clean."""
|
| 22 |
+
monkeypatch.delenv("PYTORCH_ENABLE_MPS_FALLBACK", raising=False)
|