diff options
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): |
