diff --git a/demock.patch b/demock.patch new file mode 100644 index 0000000..1c5a13f --- /dev/null +++ b/demock.patch @@ -0,0 +1,26 @@ +--- + gtts/tests/test_tts.py | 2 +- + setup.cfg | 1 - + 2 files changed, 1 insertion(+), 2 deletions(-) + +--- a/gtts/tests/test_tts.py ++++ b/gtts/tests/test_tts.py +@@ -1,7 +1,7 @@ + # -*- coding: utf-8 -*- + import os + import pytest +-from mock import Mock ++from unittest.mock import Mock + from six.moves import urllib + + from gtts.tts import gTTS, gTTSError +--- a/setup.cfg ++++ b/setup.cfg +@@ -45,7 +45,6 @@ tests = + pytest-cov + flake8 + testfixtures +- mock + six + docs = + sphinx diff --git a/network-tests.patch b/network-tests.patch new file mode 100644 index 0000000..0e8918c --- /dev/null +++ b/network-tests.patch @@ -0,0 +1,14 @@ +--- + gtts/tests/test_tts.py | 1 + + 1 file changed, 1 insertion(+) + +--- a/gtts/tests/test_tts.py ++++ b/gtts/tests/test_tts.py +@@ -84,6 +84,7 @@ def test_no_text_parts(tmp_path): + # Test write_to_fp()/save() cases not covered elsewhere in this file + + ++@pytest.mark.net + def test_bad_fp_type(): + """Raise TypeError if fp is not a file-like object (no .write())""" + # Create gTTS and save diff --git a/python-gTTS.changes b/python-gTTS.changes index b2bc0dd..848539e 100644 --- a/python-gTTS.changes +++ b/python-gTTS.changes @@ -1,3 +1,10 @@ +------------------------------------------------------------------- +Mon Mar 21 14:46:30 UTC 2022 - Matej Cepl + +- Make tests working at least a little bit. Requires two new patches: + - demock.patch (gh#pndurette/gTTS#343) + - network-tests.patch (gh#pndurette/gTTS#344) + ------------------------------------------------------------------- Mon Mar 21 13:27:59 UTC 2022 - pgajdos@suse.com diff --git a/python-gTTS.spec b/python-gTTS.spec index cc92c0a..eb37ee8 100644 --- a/python-gTTS.spec +++ b/python-gTTS.spec @@ -25,6 +25,12 @@ License: MIT Group: Development/Languages/Python URL: https://github.com/pndurette/gTTS Source: https://github.com/pndurette/gTTS/archive/refs/tags/v%{version}.tar.gz#/gTTS-%{version}.tar.gz +# PATCH-FIX-UPSTREAM demock.patch gh#pndurette/gTTS#343 mcepl@suse.com +# remove dependency on the external mock package +Patch0: demock.patch +# PATCH-FIX-UPSTREAM network-tests.patch gh#pndurette/gTTS#344 mcepl@suse.com +# one more test marked as the network requiring +Patch1: network-tests.patch BuildRequires: %{python_module beautifulsoup4} BuildRequires: %{python_module click} BuildRequires: %{python_module gTTS-token >= 1.1.3} @@ -53,7 +59,7 @@ utility. It allows unlimited lengths to be spoken by tokenizing long sentences where the speech would naturally pause. %prep -%setup -q -n gTTS-%{version} +%autosetup -p1 -n gTTS-%{version} %build %python_build @@ -65,8 +71,7 @@ sentences where the speech would naturally pause. %check # tests are sadly mostly online -# https://github.com/pndurette/gTTS/issues/343 -#%%pytest +%pytest -k 'not net' %post %python_install_alternative gtts-cli