Skip to content

Commit

Permalink
tests don't pass but they should run
Browse files Browse the repository at this point in the history
  • Loading branch information
mattieruth committed Sep 19, 2024
1 parent e524f89 commit e804f1b
Show file tree
Hide file tree
Showing 10 changed files with 170 additions and 152 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,25 +7,25 @@ on:
- main
pull_request:
branches:
- "**"
- '**'
paths-ignore:
- "docs/**"
- 'docs/**'

concurrency:
group: build-test-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
test:
name: "Unit and Integration Tests"
name: 'Unit and Integration Tests'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
id: setup_python
uses: actions/setup-python@v4
with:
python-version: "3.10"
python-version: '3.10'
- name: Install system packages
run: sudo apt-get install -y portaudio19-dev
- name: Setup virtual environment
Expand All @@ -39,4 +39,4 @@ jobs:
- name: Test with pytest
run: |
source .venv/bin/activate
pytest --doctest-modules --ignore-glob="*to_be_updated*" src tests
pytest --doctest-modules --ignore-glob="*to_be_updated*" --ignore-glob=*pipeline_source* src tests
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ pip install "path_to_this_repo[option,...]"
From the root directory, run:

```shell
pytest --doctest-modules --ignore-glob="*to_be_updated*" src tests
pytest --doctest-modules --ignore-glob="*to_be_updated*" --ignore-glob=*pipeline_source* src tests
```

## Setting up your editor
Expand Down
15 changes: 14 additions & 1 deletion dev-requirements.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
aiohttp~=3.10.3
anthropic~=0.34.0
anthropic
autopep8~=2.3.1
azure-cognitiveservices-speech~=1.40.0
build~=1.2.1
daily-python~=0.10.1
deepgram-sdk~=3.5.0
fal-client~=0.4.1
fastapi~=0.112.1
faster-whisper~=1.0.3
google-generativeai~=0.7.2
grpcio-tools~=1.62.2
langchain~=0.2.14
Expand All @@ -12,12 +16,21 @@ lmnt~=1.1.4
loguru~=0.7.2
numpy~=1.26.4
openai~=1.37.2
openpipe~=4.24.0
Pillow~=10.4.0
pip-tools~=7.4.1
pipecat-ai[gstreamer]
pyaudio~=0.2.14
pydantic~=2.8.2
pyloudnorm~=0.1.1
pyht~=0.0.28
pyright~=1.1.376
pytest~=8.3.2
python-dotenv~=1.0.1
resampy~=0.4.3
setuptools~=72.2.0
setuptools_scm~=8.1.0
silero-vad~=5.1
together~=1.2.7
transformers~=4.44.0
websockets~=12.0
2 changes: 1 addition & 1 deletion src/pipecat/frames/frames.py
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,7 @@ class BotSpeakingFrame(ControlFrame):
@dataclass
class TTSStartedFrame(ControlFrame):
"""Used to indicate the beginning of a TTS response. Following
AudioRawFrames are part of the TTS response until an TTSEndFrame. These
AudioRawFrames are part of the TTS response until an TTSStoppedFrame. These
frames can be used for aggregating audio frames in a transport to optimize
the size of frames sent to the session, without needing to control this in
the TTS service.
Expand Down
8 changes: 5 additions & 3 deletions tests/integration/integration_azure_llm.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@

import asyncio
import os
from pipecat.pipeline.openai_frames import OpenAILLMContextFrame
from pipecat.services.azure_ai_services import AzureLLMService
from pipecat.services.openai_llm_context import OpenAILLMContext
from pipecat.processors.aggregators.openai_llm_context import (
OpenAILLMContext,
OpenAILLMContextFrame
)
from pipecat.services.azure import AzureLLMService

from openai.types.chat import (
ChatCompletionSystemMessageParam,
Expand Down
8 changes: 5 additions & 3 deletions tests/integration/integration_ollama_llm.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
import unittest

import asyncio
from pipecat.pipeline.openai_frames import OpenAILLMContextFrame
from pipecat.services.openai_llm_context import OpenAILLMContext
from pipecat.processors.aggregators.openai_llm_context import (
OpenAILLMContext,
OpenAILLMContextFrame
)

from openai.types.chat import (
ChatCompletionSystemMessageParam,
)
from pipecat.services.ollama_ai_services import OLLamaLLMService
from pipecat.services.ollama import OLLamaLLMService

if __name__ == "__main__":
@unittest.skip("Skip azure integration test")
Expand Down
44 changes: 22 additions & 22 deletions tests/test_aggregators.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,18 @@
import functools
import unittest

from pipecat.processors.aggregators import (
GatedAggregator,
ParallelPipeline,
SentenceAggregator,
StatelessTextTransformer,
)
from pipecat.processors.aggregators.gated import GatedAggregator
from pipecat.processors.aggregators.sentence import SentenceAggregator
from pipecat.processors.text_transformer import StatelessTextTransformer

from pipecat.pipeline.parallel_pipeline import ParallelPipeline

from pipecat.frames.frames import (
AudioFrame,
AudioRawFrame,
EndFrame,
ImageFrame,
LLMResponseEndFrame,
LLMResponseStartFrame,
ImageRawFrame,
LLMFullResponseEndFrame,
LLMFullResponseStartFrame,
Frame,
TextFrame,
)
Expand Down Expand Up @@ -46,27 +46,27 @@ async def test_sentence_aggregator(self):
async def test_gated_accumulator(self):
gated_aggregator = GatedAggregator(
gate_open_fn=lambda frame: isinstance(
frame, ImageFrame), gate_close_fn=lambda frame: isinstance(
frame, LLMResponseStartFrame), start_open=False, )
frame, ImageRawFrame), gate_close_fn=lambda frame: isinstance(
frame, LLMFullResponseStartFrame), start_open=False, )

frames = [
LLMResponseStartFrame(),
LLMFullResponseStartFrame(),
TextFrame("Hello, "),
TextFrame("world."),
AudioFrame(b"hello"),
ImageFrame(b"image", (0, 0)),
AudioFrame(b"world"),
LLMResponseEndFrame(),
AudioRawFrame(b"hello"),
ImageRawFrame(b"image", (0, 0)),
AudioRawFrame(b"world"),
LLMFullResponseEndFrame(),
]

expected_output_frames = [
ImageFrame(b"image", (0, 0)),
LLMResponseStartFrame(),
ImageRawFrame(b"image", (0, 0)),
LLMFullResponseStartFrame(),
TextFrame("Hello, "),
TextFrame("world."),
AudioFrame(b"hello"),
AudioFrame(b"world"),
LLMResponseEndFrame(),
AudioRawFrame(b"hello"),
AudioRawFrame(b"world"),
LLMFullResponseEndFrame(),
]
for frame in frames:
async for out_frame in gated_aggregator.process_frame(frame):
Expand Down
3 changes: 2 additions & 1 deletion tests/test_pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
import unittest
from unittest.mock import Mock

from pipecat.processors.aggregators import SentenceAggregator, StatelessTextTransformer
from pipecat.processors.aggregators.sentence import SentenceAggregator
from pipecat.processors.text_transformer import StatelessTextTransformer
from pipecat.processors.frame_processor import FrameProcessor
from pipecat.frames.frames import EndFrame, TextFrame

Expand Down
4 changes: 2 additions & 2 deletions tests/test_protobuf_serializer.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import unittest

from pipecat.frames.frames import AudioFrame, TextFrame, TranscriptionFrame
from pipecat.frames.frames import AudioRawFrame, TextFrame, TranscriptionFrame
from pipecat.serializers.protobuf import ProtobufFrameSerializer


Expand All @@ -20,7 +20,7 @@ async def test_roundtrip(self):
self.serializer.serialize(transcription_frame))
self.assertEqual(frame, transcription_frame)

audio_frame = AudioFrame(data=b'1234567890')
audio_frame = AudioRawFrame(data=b'1234567890')
frame = self.serializer.deserialize(
self.serializer.serialize(audio_frame))
self.assertEqual(frame, audio_frame)
Expand Down
Loading

0 comments on commit e804f1b

Please sign in to comment.