tests: allow passing observers to run_test()

This commit is contained in:
Aleix Conchillo Flaqué
2025-05-12 17:53:02 -07:00
parent 12d49a9b9d
commit f800e35ccb
2 changed files with 7 additions and 1 deletions

View File

@@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased] ## [Unreleased]
### Added
- Allow passing observers to `run_test()` while running unit tests.
### Changed ### Changed
- `GoogleLLMService` has been updated to use `google-genai` instead of the - `GoogleLLMService` has been updated to use `google-genai` instead of the

View File

@@ -6,7 +6,7 @@
import asyncio import asyncio
from dataclasses import dataclass from dataclasses import dataclass
from typing import Any, Awaitable, Callable, Dict, Optional, Sequence, Tuple from typing import Any, Awaitable, Callable, Dict, List, Optional, Sequence, Tuple
from pipecat.frames.frames import ( from pipecat.frames.frames import (
EndFrame, EndFrame,
@@ -79,6 +79,7 @@ async def run_test(
expected_down_frames: Optional[Sequence[type]] = None, expected_down_frames: Optional[Sequence[type]] = None,
expected_up_frames: Optional[Sequence[type]] = None, expected_up_frames: Optional[Sequence[type]] = None,
ignore_start: bool = True, ignore_start: bool = True,
observers: List[BaseObserver] = [],
start_metadata: Dict[str, Any] = {}, start_metadata: Dict[str, Any] = {},
send_end_frame: bool = True, send_end_frame: bool = True,
) -> Tuple[Sequence[Frame], Sequence[Frame]]: ) -> Tuple[Sequence[Frame], Sequence[Frame]]:
@@ -100,6 +101,7 @@ async def run_test(
task = PipelineTask( task = PipelineTask(
pipeline, pipeline,
params=PipelineParams(start_metadata=start_metadata), params=PipelineParams(start_metadata=start_metadata),
observers=observers,
cancel_on_idle_timeout=False, cancel_on_idle_timeout=False,
) )