mosaic-zero / tests /conftest.py
raylim's picture
Apply Black code formatting to test files
6241f9d unverified
raw
history blame
1.03 kB
"""Pytest configuration and fixtures."""
import sys
from unittest.mock import MagicMock
# Create mock for gradio with Error class
class GradioMock(MagicMock):
"""Mock for gradio that supports Error and Warning classes."""
Error = Exception
@staticmethod
def Warning(msg):
"""Mock Warning that accepts a message."""
return None
Request = MagicMock
Progress = MagicMock
# Mock heavy dependencies before any imports
# This is necessary to allow tests to run without full environment setup
sys.modules["mussel"] = MagicMock()
sys.modules["mussel.models"] = MagicMock()
sys.modules["mussel.utils"] = MagicMock()
sys.modules["mussel.utils.segment"] = MagicMock()
sys.modules["mussel.cli"] = MagicMock()
sys.modules["mussel.cli.tessellate"] = MagicMock()
sys.modules["gradio"] = GradioMock()
sys.modules["huggingface_hub"] = MagicMock()
sys.modules["loguru"] = MagicMock()
# Import fixtures from test_fixtures.py to make them available to all tests
pytest_plugins = ["tests.test_fixtures"]