diff --git a/strata_cli/launch/screens.py b/strata_cli/launch/screens.py index 03e5cb22..8c26b796 100644 --- a/strata_cli/launch/screens.py +++ b/strata_cli/launch/screens.py @@ -761,8 +761,8 @@ class FolderScreen(Base): out.append("The free space of that folder could not be read.", style=MUTE) moving = self.models_that_would_move(value) if moving: - out.append(f"\nModel files Strata already keeps in {moving} are moved into this folder when you start " - "(quick on the same drive; on another drive they stay where they are and are used from there).", style=WARN) + out.append(f"\nModel files Strata already keeps in {moving} stay there and keep working. This folder is used for new downloads. " + "To move them here, use: strata models move.", style=MUTE) self.query_one("#folderinfo", Static).update(out) def models_that_would_move(self, value: str) -> str | None: diff --git a/tests/terminal/test_launch_tui.py b/tests/terminal/test_launch_tui.py index 73aa35cb..25118b95 100644 --- a/tests/terminal/test_launch_tui.py +++ b/tests/terminal/test_launch_tui.py @@ -333,13 +333,14 @@ class FolderStep(Base): (old / "models" / "Q2_0" / "x.gguf").write_text("x") with mock.patch.object(type(ctx.catalog), "data_dir", return_value=old): await press(pilot, "enter", "enter") - self.assertNotIn("are moved into this folder", text_of(app)) + self.assertNotIn("stay there and keep working", text_of(app)) f = app.screen.query_one("#folderpath") f.value = "" await typed(pilot, str(self.home.base / "new-data")) t = " ".join(text_of(app).replace("\n", " ").split()) self.assertIn("Model files Strata already keeps in", t) - self.assertIn("are moved into this folder when you start", t) + self.assertIn("stay there and keep working", t) + self.assertNotIn("are moved into this folder", t) self.run_app(case) def test_keeping_the_default_stores_nothing(self): diff --git a/tests/terminal/test_tui3.py b/tests/terminal/test_tui3.py index 4dd0a64f..4143112d 100644 --- a/tests/terminal/test_tui3.py +++ b/tests/terminal/test_tui3.py @@ -98,5 +98,46 @@ class FailedStart(unittest.TestCase): self.assertEqual(calls, ["stop", "cleanup"]) +class FolderChangeMovesNothing(unittest.TestCase): + """The Folder step text: changing the folder never moves the models Strata already keeps (only --move-data / strata models move do).""" + + def setUp(self): + self.home = Home().__enter__() + self.addCleanup(self.home.__exit__, None, None, None) + p = mock.patch.object(Catalog, "hardware", lambda self, fresh=False: dict(HW_12, disk_free_gb=500.0)) + p.start() + self.addCleanup(p.stop) + + def test_start_passes_no_move_flag_unless_asked(self): + s = S.LaunchSettings(family="qwen", model="IQ3_XXS", context=32768, data_dir=str(self.home.base / "new")) + self.assertNotIn("--move-data", Runner(s, catalog=catalog()).setup_args()) + self.assertIn("--move-data", Runner(s, catalog=catalog(), move_data=True).setup_args()) + + def test_setup_keeps_the_existing_models_where_they_are(self): + import contextlib + import io + import setup + base = self.home.base + old, new, root = base / "old-data", base / "new-data", base / "Strata" + root.mkdir() + weights = old / "models" / "Q2_0" / "w.gguf" + weights.parent.mkdir(parents=True) + weights.write_bytes(b"x" * 100) + env = {"APPDATA": str(base / "appdata"), "XDG_CONFIG_HOME": str(base / "appdata")} + with mock.patch.dict(os.environ, env), mock.patch.object(setup, "ROOT", root), mock.patch.object(setup, "_CONTROL_HOME", None): + os.environ.pop("STRATA_SETTINGS_FILE", None) + setup.settings_path().parent.mkdir(parents=True, exist_ok=True) + setup.settings_path().write_text(json.dumps({"data_dir": str(old), "installs": []}), encoding="utf-8") + with contextlib.redirect_stdout(io.StringIO()): + setup.data_folder(str(new), move=False, yes=True, set_default=True) + self.assertTrue(weights.is_file()) + self.assertFalse((new / "models").exists()) + + def test_the_screen_text_says_they_stay(self): + src = open(os.path.join(os.path.dirname(R.__file__), "screens.py"), encoding="utf-8").read() + self.assertIn("stay there and keep working", src) + self.assertNotIn("are moved into this folder when you start", src) + + if __name__ == "__main__": unittest.main()