phase 7
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
"""Tests for the LangGraph detection pipeline."""
|
||||
|
||||
import os
|
||||
|
||||
import pytest
|
||||
|
||||
from detect.graph import NODES, build_graph, get_pipeline
|
||||
@@ -9,6 +11,22 @@ from detect.state import DetectState
|
||||
VIDEO = "media/out/chunks/95043d50-4df6-4ac8-bbd5-2ba873117c6e/chunk_0000.mp4"
|
||||
|
||||
|
||||
def _has_inference() -> bool:
|
||||
if os.environ.get("INFERENCE_URL"):
|
||||
return True
|
||||
try:
|
||||
import ultralytics
|
||||
return True
|
||||
except ImportError:
|
||||
return False
|
||||
|
||||
|
||||
requires_inference = pytest.mark.skipif(
|
||||
not _has_inference(),
|
||||
reason="Needs INFERENCE_URL or ultralytics installed",
|
||||
)
|
||||
|
||||
|
||||
def test_graph_compiles():
|
||||
pipeline = get_pipeline()
|
||||
assert pipeline is not None
|
||||
@@ -20,6 +38,7 @@ def test_graph_has_all_nodes():
|
||||
assert node in graph.nodes
|
||||
|
||||
|
||||
@requires_inference
|
||||
def test_graph_runs_end_to_end(monkeypatch):
|
||||
"""Run the full graph with mocked event emission."""
|
||||
events = []
|
||||
@@ -52,6 +71,7 @@ def test_graph_runs_end_to_end(monkeypatch):
|
||||
assert len(complete_events) == 1
|
||||
|
||||
|
||||
@requires_inference
|
||||
def test_graph_node_transitions(monkeypatch):
|
||||
"""Verify each node emits running → done transitions."""
|
||||
events = []
|
||||
|
||||
Reference in New Issue
Block a user