Skip to content

Commit

Permalink
Merge pull request #785 from ftnext/maint/run-tests-py313
Browse files Browse the repository at this point in the history
Run tests on Python 3.13 (excluding whisper-local)
  • Loading branch information
ftnext authored Nov 3, 2024
2 parents 46bb470 + aadaec7 commit 7614f10
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
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

0 comments on commit 7614f10

Please sign in to comment.