aboutsummaryrefslogtreecommitdiff
path: root/tests/test_backends.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/test_backends.py')
-rw-r--r--tests/test_backends.py11
1 files changed, 10 insertions, 1 deletions
diff --git a/tests/test_backends.py b/tests/test_backends.py
index 8ee1be8..c0e8d4a 100644
--- a/tests/test_backends.py
+++ b/tests/test_backends.py
@@ -9,6 +9,13 @@ from backends import REGISTRY, detect_all, get
class RegistryTests(unittest.TestCase):
+ def setUp(self):
+ # The registry is built lazily on first access (the backend modules
+ # pull in converter.tts and its deps, which are only available inside
+ # the managed venv). Trigger the build so these tests don't depend on
+ # another test class having called detect_all() first.
+ get("audiocpp")
+
def test_registry_has_the_three_backends(self):
keys = [info.key for info in REGISTRY]
self.assertEqual(keys, ["audiocpp", "qwen", "faster"])
@@ -138,6 +145,7 @@ class ServerRunningTests(unittest.TestCase):
def test_true_for_open_port(self):
import socket
+
from backends import common
server = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
server.bind(("127.0.0.1", 0))
@@ -150,9 +158,10 @@ class ServerRunningTests(unittest.TestCase):
server.close()
def test_false_for_closed_port(self):
- from backends import common
# Pick an unused port by opening + closing a socket, then probe it.
import socket
+
+ from backends import common
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.bind(("127.0.0.1", 0))
_, port = s.getsockname()