obj_localizer / tests /test_app_smoke.py
3v324v23's picture
fix: resolve all ruff lint errors
cf388f7
Raw
History Blame Contribute Delete
1.43 kB
"""Smoke tests for the Gradio app — import-level checks only."""
import pytest
def test_app_module_imports():
"""Verify lightweight source modules can be imported without error."""
import src.config # noqa: F401
import src.parsing # noqa: F401
import src.prompts # noqa: F401
def test_config_values():
from src.config import APP_SUBTITLE, APP_TITLE, COORD_MAX, MODEL_ID
assert MODEL_ID == "nvidia/LocateAnything-3B"
assert COORD_MAX == 1000
assert len(APP_TITLE) > 0
assert len(APP_SUBTITLE) > 0
def test_visualization_import():
"""Verify visualization module imports."""
import src.visualization
assert hasattr(src.visualization, "draw_boxes")
assert hasattr(src.visualization, "create_no_detection_overlay")
def test_app_build_callable():
"""Verify the Gradio app builder is importable and callable."""
try:
from app import build_app
assert callable(build_app)
except ImportError:
pytest.skip("Gradio not available in test environment")
def test_inference_module_imports():
"""Verify inference module structure without heavy imports."""
try:
from src.inference import LocateAnythingWorker
w = LocateAnythingWorker.__new__(LocateAnythingWorker)
assert not getattr(w, "_loaded", True)
except ImportError:
pytest.skip("transformers/torch not available in test environment")