summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tests/test_g2p.py2
-rw-r--r--tests/test_stt.py21
-rw-r--r--tests/test_vocabcompiler.py4
3 files changed, 24 insertions, 3 deletions
diff --git a/tests/test_g2p.py b/tests/test_g2p.py
index e18ebff..7904cbf 100644
--- a/tests/test_g2p.py
+++ b/tests/test_g2p.py
@@ -15,7 +15,7 @@ def phonetisaurus_installed():
return True
-@unittest.skipUnless(phonetisaurus_installed,
+@unittest.skipUnless(phonetisaurus_installed(),
"Phonetisaurus or fst_model not present")
class TestG2P(unittest.TestCase):
diff --git a/tests/test_stt.py b/tests/test_stt.py
index 267c1c2..cb33ff6 100644
--- a/tests/test_stt.py
+++ b/tests/test_stt.py
@@ -1,9 +1,30 @@
#!/usr/bin/env python2
# -*- coding: utf-8-*-
import unittest
+import imp
from client import stt, jasperpath
+def cmuclmtk_installed():
+ try:
+ imp.find_module('cmuclmtk')
+ except ImportError:
+ return False
+ else:
+ return True
+
+
+def pocketsphinx_installed():
+ try:
+ imp.find_module('pocketsphinx')
+ except ImportError:
+ return False
+ else:
+ return True
+
+
+@unittest.skipUnless(cmuclmtk_installed(), "CMUCLMTK not present")
+@unittest.skipUnless(pocketsphinx_installed(), "Pocketsphinx not present")
class TestSTT(unittest.TestCase):
def setUp(self):
diff --git a/tests/test_vocabcompiler.py b/tests/test_vocabcompiler.py
index 561440a..f9e427f 100644
--- a/tests/test_vocabcompiler.py
+++ b/tests/test_vocabcompiler.py
@@ -90,8 +90,8 @@ class TestVocabulary(unittest.TestCase):
self.vocab.compile(phrases, force=True)
-@unittest.skipIf(vocabcompiler.cmuclmtk is None,
- "CMUCLMTK not present")
+@unittest.skipUnless(hasattr(vocabcompiler, 'cmuclmtk'),
+ "CMUCLMTK not present")
class TestPocketsphinxVocabulary(TestVocabulary):
VOCABULARY = vocabcompiler.PocketsphinxVocabulary