aboutsummaryrefslogtreecommitdiff
path: root/tests/test_backends.py
diff options
context:
space:
mode:
authorhistoria <historiavg@proton.me>2026-08-24 01:57:13 -0400
committerhistoria <historiavg@proton.me>2026-08-24 01:58:17 -0400
commitc02d66b2d3221c0c5f5e8f2cb2ae218f1e325a0a (patch)
treee9ec4f35c18102d4624d3cd59358d192be7bbfcb /tests/test_backends.py
parent194c63e4d11e6de9792a736a7b99788f1db78741 (diff)
downloadtts-audiobook-generator-c02d66b2d3221c0c5f5e8f2cb2ae218f1e325a0a.tar.gz
feat: manage venv for all backends
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()