diff options
| author | historia <historiavg@proton.me> | 2026-08-27 17:03:57 -0400 |
|---|---|---|
| committer | historia <historiavg@proton.me> | 2026-08-27 17:03:57 -0400 |
| commit | cef2352a5e81b272d067c2c02eb9588e54edfcfd (patch) | |
| tree | 83af416a82d9e854f44b6f3207eb8ea648b0896d /app/tests/test_backends_envs.py | |
| parent | 6527240aa69a08f06e36e796818721abeec9f592 (diff) | |
| download | tts-audiobook-generator-cef2352a5e81b272d067c2c02eb9588e54edfcfd.tar.gz | |
feat: automatic updates added to configure backend menu
Diffstat (limited to 'app/tests/test_backends_envs.py')
| -rw-r--r-- | app/tests/test_backends_envs.py | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/app/tests/test_backends_envs.py b/app/tests/test_backends_envs.py index 8b17458..2f0f910 100644 --- a/app/tests/test_backends_envs.py +++ b/app/tests/test_backends_envs.py @@ -154,6 +154,34 @@ class PipInstallTests(unittest.TestCase): self.assertEqual(rc, 1) run.assert_not_called() + def test_upgrade_adds_the_u_flag(self): + calls = [] + + def fake_run(argv, **kwargs): + calls.append(list(argv)) + return 0 + + with patch.object(envs, "env_exists", return_value=True), \ + patch.object(envs.common, "run_console_subprocess", + side_effect=fake_run): + self.assertEqual(envs.pip_install(["qwen-tts"], upgrade=True), 0) + self.assertIn("-U", calls[0]) + # -U sits before the packages; nothing else about the argv changes. + self.assertLess(calls[0].index("-U"), calls[0].index("qwen-tts")) + + def test_no_upgrade_flag_by_default(self): + calls = [] + + def fake_run(argv, **kwargs): + calls.append(list(argv)) + return 0 + + with patch.object(envs, "env_exists", return_value=True), \ + patch.object(envs.common, "run_console_subprocess", + side_effect=fake_run): + self.assertEqual(envs.pip_install(["qwen-tts"]), 0) + self.assertNotIn("-U", calls[0]) + class PipUninstallTests(unittest.TestCase): def test_missing_env_is_success_without_running_pip(self): |
