[Python-modules-commits] [speechrecognition-python] 03/08: Add patches

Ethan Ward ethanward-guest at moszumanska.debian.org
Fri Sep 1 23:13:58 UTC 2017


This is an automated email from the git hooks/post-receive script.

ethanward-guest pushed a commit to branch master
in repository speechrecognition-python.

commit 77caa95a2839cec5d2ee1a9dc3f0a8c7f160eba6
Author: Ethan Ward <ethan.ward at mycroft.ai>
Date:   Fri Sep 1 12:25:31 2017 -0500

    Add patches
---
 debian/patches/0001-Allow-disabling-tests.patch | 88 +++++++++++++++++++++++++
 debian/patches/series                           |  1 +
 2 files changed, 89 insertions(+)

diff --git a/debian/patches/0001-Allow-disabling-tests.patch b/debian/patches/0001-Allow-disabling-tests.patch
new file mode 100644
index 0000000..1b16137
--- /dev/null
+++ b/debian/patches/0001-Allow-disabling-tests.patch
@@ -0,0 +1,88 @@
+From: Ethan Ward <ethan.ward at mycroft.ai>
+Date: Fri, 1 Sep 2017 12:16:56 -0500
+Subject: Allow disabling tests
+
+---
+ tests/test_audio.py            | 4 ++++
+ tests/test_recognition.py      | 4 ++++
+ tests/test_special_features.py | 1 +
+ 3 files changed, 9 insertions(+)
+
+diff --git a/tests/test_audio.py b/tests/test_audio.py
+index 4a18860..13f779d 100644
+--- a/tests/test_audio.py
++++ b/tests/test_audio.py
+@@ -98,6 +98,7 @@ class TestAudioFile(unittest.TestCase):
+         self.assertEqual(audio.sample_width, 2)
+         self.assertSimilar(audio.get_raw_data()[:32], b"\x00\x00\xfe\xff\x02\x00\xfe\xff\xff\xff\x04\x00\xfa\xff\x04\x00\xfa\xff\t\x00\xf6\xff\n\x00\xfa\xff\xff\xff\x08\x00\xf5\xff")
+ 
++    @unittest.skipIf(os.environ.get("FLAC_TEST_SKIP", False), "Skipping flac tests")
+     def test_flac_mono_16_bit(self):
+         r = sr.Recognizer()
+         with sr.AudioFile(path.join(path.dirname(path.realpath(__file__)), "audio-mono-16-bit-44100Hz.flac")) as source: audio = r.record(source)
+@@ -106,6 +107,7 @@ class TestAudioFile(unittest.TestCase):
+         self.assertEqual(audio.sample_width, 2)
+         self.assertSimilar(audio.get_raw_data()[:32], b"\x00\x00\xff\xff\x01\x00\xff\xff\x00\x00\x01\x00\xfe\xff\x02\x00\xfc\xff\x06\x00\xf9\xff\x06\x00\xfe\xff\xfe\xff\x05\x00\xfa\xff")
+ 
++    @unittest.skipIf(os.environ.get("FLAC_TEST_SKIP", False), "Skipping flac tests")
+     def test_flac_mono_24_bit(self):
+         r = sr.Recognizer()
+         with sr.AudioFile(path.join(path.dirname(path.realpath(__file__)), "audio-mono-24-bit-44100Hz.flac")) as source: audio = r.record(source)
+@@ -116,6 +118,7 @@ class TestAudioFile(unittest.TestCase):
+         else:
+             self.assertSimilar(audio.get_raw_data()[:32], b"\x00\x00\x00\x00\x00\xff\xfe\xff\x00\x02\x01\x00\x00\xfd\xfe\xff\x00\x04\x00\x00\x00\xfc\x00\x00\x00\x04\xfe\xff\x00\xfb\x00\x00")
+ 
++    @unittest.skipIf(os.environ.get("FLAC_TEST_SKIP", False), "Skipping flac tests")
+     def test_flac_stereo_16_bit(self):
+         r = sr.Recognizer()
+         with sr.AudioFile(path.join(path.dirname(path.realpath(__file__)), "audio-stereo-16-bit-44100Hz.flac")) as source: audio = r.record(source)
+@@ -124,6 +127,7 @@ class TestAudioFile(unittest.TestCase):
+         self.assertEqual(audio.sample_width, 2)
+         self.assertSimilar(audio.get_raw_data()[:32], b"\xff\xff\xff\xff\x02\x00\xfe\xff\x00\x00\x01\x00\xfd\xff\x01\x00\xff\xff\x04\x00\xfa\xff\x05\x00\xff\xff\xfd\xff\x08\x00\xf6\xff")
+ 
++    @unittest.skipIf(os.environ.get("FLAC_TEST_SKIP", False), "Skipping flac tests")
+     def test_flac_stereo_24_bit(self):
+         r = sr.Recognizer()
+         with sr.AudioFile(path.join(path.dirname(path.realpath(__file__)), "audio-stereo-24-bit-44100Hz.flac")) as source: audio = r.record(source)
+diff --git a/tests/test_recognition.py b/tests/test_recognition.py
+index 269dc00..4c78c99 100644
+--- a/tests/test_recognition.py
++++ b/tests/test_recognition.py
+@@ -13,21 +13,25 @@ class TestRecognition(unittest.TestCase):
+         self.AUDIO_FILE_FR = os.path.join(os.path.dirname(os.path.realpath(__file__)), "french.aiff")
+         self.AUDIO_FILE_ZH = os.path.join(os.path.dirname(os.path.realpath(__file__)), "chinese.flac")
+ 
++    @unittest.skipIf(os.environ.get("POCKETSPHINX_TEST_SKIP"), "Skipping pocketsphinx tests")
+     def test_sphinx_english(self):
+         r = sr.Recognizer()
+         with sr.AudioFile(self.AUDIO_FILE_EN) as source: audio = r.record(source)
+         self.assertEqual(r.recognize_sphinx(audio), "wanted to three")
+ 
++    @unittest.skipIf(os.environ.get("GOOGLE_TEST_SKIP",False), "Requires internet connection")
+     def test_google_english(self):
+         r = sr.Recognizer()
+         with sr.AudioFile(self.AUDIO_FILE_EN) as source: audio = r.record(source)
+         self.assertEqual(r.recognize_google(audio), "one two three")
+ 
++    @unittest.skipIf(os.environ.get("GOOGLE_TEST_SKIP",False), "Requires internet connection")
+     def test_google_french(self):
+         r = sr.Recognizer()
+         with sr.AudioFile(self.AUDIO_FILE_FR) as source: audio = r.record(source)
+         self.assertEqual(r.recognize_google(audio, language="fr-FR"), u"et c'est la dictée numéro 1")
+ 
++    @unittest.skipIf(os.environ.get("GOOGLE_TEST_SKIP",False), "Requires internet connection")
+     def test_google_chinese(self):
+         r = sr.Recognizer()
+         with sr.AudioFile(self.AUDIO_FILE_ZH) as source: audio = r.record(source)
+diff --git a/tests/test_special_features.py b/tests/test_special_features.py
+index c77ab44..e9cc92b 100644
+--- a/tests/test_special_features.py
++++ b/tests/test_special_features.py
+@@ -11,6 +11,7 @@ class TestSpecialFeatures(unittest.TestCase):
+     def setUp(self):
+         self.AUDIO_FILE_EN = os.path.join(os.path.dirname(os.path.realpath(__file__)), "english.wav")
+ 
++    @unittest.skipIf(os.environ.get('POCKETSPHINX_TEST_SKIP', FALSE),"Skipping pocketsphinx tests")
+     def test_sphinx_keywords(self):
+         r = sr.Recognizer()
+         with sr.AudioFile(self.AUDIO_FILE_EN) as source: audio = r.record(source)
diff --git a/debian/patches/series b/debian/patches/series
new file mode 100644
index 0000000..e2d87a7
--- /dev/null
+++ b/debian/patches/series
@@ -0,0 +1 @@
+0001-Allow-disabling-tests.patch

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/speechrecognition-python.git



More information about the Python-modules-commits mailing list