diff options
Diffstat (limited to 'app/tests/test_backends.py')
| -rw-r--r-- | app/tests/test_backends.py | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/app/tests/test_backends.py b/app/tests/test_backends.py index 1e1a3f9..7fdcce6 100644 --- a/app/tests/test_backends.py +++ b/app/tests/test_backends.py @@ -420,7 +420,8 @@ class QwenUninstallWeightsTests(unittest.TestCase): return_value=0) as mk_pip: rc = qwen.uninstall(emit="EMIT") self.assertEqual(rc, 0) - mk_pip.assert_called_once_with([qwen.QWEN_PIP_PKG], emit="EMIT") + mk_pip.assert_called_once_with([qwen.QWEN_PIP_PKG], emit="EMIT", + env_dir=qwen.QWEN_ENV) self.assertEqual(list(Path(td).iterdir()), []) def test_weights_deleted_even_when_pip_failed(self): @@ -459,7 +460,8 @@ class QwenUninstallWeightsTests(unittest.TestCase): side_effect=pip_flips_cancel) as mk_pip: rc = qwen.uninstall(cancel=cancel) self.assertEqual(rc, 130) - mk_pip.assert_called_once_with([qwen.QWEN_PIP_PKG], emit=None) + mk_pip.assert_called_once_with([qwen.QWEN_PIP_PKG], emit=None, + env_dir=qwen.QWEN_ENV) # Cancelled between phases: the weights stay untouched... self.assertEqual(len(list(Path(td).iterdir())), 3) @@ -549,13 +551,14 @@ class QwenInstallModelTests(unittest.TestCase): def test_hf_cli_prefers_hf_then_falls_back(self): from backends import qwen with tempfile.TemporaryDirectory() as td: - with patch.object(qwen.envs, "ENV_DIR", Path(td)): + # The CLI is looked up in the qwen backend's own venv. + with patch.object(qwen, "QWEN_ENV", Path(td)): self.assertIsNone(qwen._hf_download_prefix()) - cli = qwen.envs.env_script("huggingface-cli") + cli = qwen.envs.env_script("huggingface-cli", qwen.QWEN_ENV) cli.parent.mkdir(parents=True) cli.write_bytes(b"x") self.assertEqual(qwen._hf_download_prefix(), [str(cli)]) - hf = qwen.envs.env_script("hf") + hf = qwen.envs.env_script("hf", qwen.QWEN_ENV) hf.write_bytes(b"x") self.assertEqual(qwen._hf_download_prefix(), [str(hf)]) @@ -827,8 +830,10 @@ class QwenUninstallTests(unittest.TestCase): self.assertEqual(rc, 0) self.assertEqual([c.args[0] for c in mk_stop.call_args_list], ["qwen"]) - # The task view's emit is forwarded so pip never touches the terminal. - mk_pip.assert_called_once_with([qwen.QWEN_PIP_PKG], emit="EMIT") + # The task view's emit is forwarded so pip never touches the terminal, + # and the package comes out of the qwen backend's own venv. + mk_pip.assert_called_once_with([qwen.QWEN_PIP_PKG], emit="EMIT", + env_dir=qwen.QWEN_ENV) def test_skips_stop_when_no_server_was_started(self): # No pid files: stop() is not called (no "not started by this |
