Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions makefile
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,9 @@ check: format-check lint type-check ## Run all checks (format, lint, type-check)

fix: format lint-fix ## Run format and lint checks and fix issues automatically (format, lint)

unit-tests: ## Run unit tests (modules marked with `pytestmark = pytest.mark.unit`)
unit-tests: ## Run unit tests (modules marked `pytest.mark.unit` or `pytest.mark.audio_eot`)
@echo "$(BOLD)$(CYAN)Running unit tests...$(RESET)"
PYTHONPATH="$$PWD" uv run pytest --unit $(PYTEST_ARGS)
PYTHONPATH="$$PWD" uv run pytest --unit --audio_eot $(PYTEST_ARGS)

# ============================================
# Development Workflows
Expand Down
10 changes: 7 additions & 3 deletions tests/test_audio_recognition_turn_detection.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@ def _make_full_recognition_for_eou() -> AudioRecognition:
ar._turn_detector_stream = stream_mock
ar._turn_detector_prediction_fut = None
ar._turn_detector_flushed = False
ar._turn_backchannel_over_agent = False
ar._stt_consumer_atask = None
ar._turn_detector_late_prediction_warned = False
ar._agent_speaking = False
ar._interruption_enabled = False
Expand Down Expand Up @@ -349,7 +351,7 @@ async def test_clear_user_turn_allows_next_turn_to_emit(self) -> None:
ar._turn_detector_stream.flush = MagicMock()
ar.update_stt = MagicMock() # type: ignore[method-assign]

ar.clear_user_turn()
ar._clear_user_turn()

assert ar._last_emitted_prediction is None

Expand Down Expand Up @@ -581,7 +583,9 @@ async def test_late_stt_final_after_flush_short_circuits(

assert ar._turn_detector_stream.predict.call_count == 0
ar._hooks.on_eot_prediction.assert_not_called()
flush_warnings = [r for r in caplog.records if "already flushed" in r.getMessage()]
flush_warnings = [
r for r in caplog.records if "after turn has been committed" in r.getMessage()
]
assert len(flush_warnings) == 1

async def test_predict_timeout_signals_fallback_and_drops_future(self) -> None:
Expand Down Expand Up @@ -695,7 +699,7 @@ def test_update_turn_detector_validates_pairing(self) -> None:
detector = MagicMock(spec=_StreamingTurnDetector)

with pytest.raises(ValueError, match="min_silence_duration"):
ar.update_turn_detector(detector)
ar._update_turn_detector(detector)

# Aborted before building a stream — and without calling .stream().
assert ar._turn_detector_stream is None
Expand Down