Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run tests on Python 3.13 (excluding whisper-local) #785

Merged
merged 7 commits into from
Nov 3, 2024
Merged
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
11 changes: 9 additions & 2 deletions .github/workflows/unittests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ jobs:
python-version: "3.11"
- os: ubuntu-latest
python-version: "3.12"
- os: ubuntu-latest
python-version: "3.13"
- os: windows-latest
python-version: "3.11"
runs-on: ${{ matrix.os }}
Expand All @@ -43,10 +45,15 @@ jobs:
if: matrix.os == 'ubuntu-latest'
run: |
python -m pip install 'pocketsphinx<5'
- name: Install Python dependencies (Ubuntu)
if: matrix.os == 'ubuntu-latest'
- name: Install Python dependencies (Ubuntu, <=3.12)
if: matrix.os == 'ubuntu-latest' && matrix.python-version != '3.13'
run: |
python -m pip install .[dev,audio,whisper-local,whisper-api]
- name: Install Python dependencies (Ubuntu, 3.13)
if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.13'
run: |
python -m pip install standard-aifc setuptools
python -m pip install --no-build-isolation .[dev,audio,whisper-api]
- name: Install Python dependencies (Windows)
if: matrix.os == 'windows-latest'
run: |
Expand Down
8 changes: 5 additions & 3 deletions tests/test_whisper_recognition.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
from unittest import TestCase
import sys
from unittest import TestCase, skipIf
from unittest.mock import MagicMock, patch

import numpy as np

from speech_recognition import AudioData, Recognizer


@skipIf(sys.version_info >= (3, 13), "skip on Python 3.13")
@patch("speech_recognition.io.BytesIO")
@patch("soundfile.read")
@patch("torch.cuda.is_available")
Expand All @@ -14,6 +14,8 @@ class RecognizeWhisperTestCase(TestCase):
def test_default_parameters(
self, load_model, is_available, sf_read, BytesIO
):
import numpy as np

whisper_model = load_model.return_value
transcript = whisper_model.transcribe.return_value
audio_array = MagicMock()
Expand Down