okami.mom/strata

git clone https://git.nkp.pet/okami.mom/strata

Niko1221setup: banner names the chosen family; the user's own home (root's included) is allowed as a data folder; a missing DeepSeek engine package is said plainly (supported cards), the developer hint only with --verbose; tests00ce92068

main
1.3 KiB34 linesraw
1"""strata_control/folders.problem: a system folder is refused, except inside the running user's own home (root's /root included)."""
2from __future__ import annotations
3
4import os
5import tempfile
6import unittest
7from pathlib import Path
8from unittest import mock
9
10from strata_control import folders
11
12
13class OwnHome(unittest.TestCase):
14    def test_a_system_folder_is_still_refused(self):
15        root = folders._system_roots()[0]
16        with mock.patch.dict(os.environ, {"HOME": tempfile.gettempdir(), "USERPROFILE": tempfile.gettempdir()}):
17            p = folders.problem(str(Path(root) / "strata-models"))
18        self.assertIsNotNone(p)
19        self.assertIn("system folder", p[0])
20
21    def test_the_users_own_home_is_allowed_even_when_it_is_under_a_system_root(self):
22        with tempfile.TemporaryDirectory() as d:
23            home = Path(d) / "rootlike"
24            home.mkdir()
25            with mock.patch.object(folders, "_system_roots", lambda: [d]), \
26                    mock.patch.dict(os.environ, {"HOME": str(home), "USERPROFILE": str(home)}):
27                self.assertIsNone(folders.problem(str(home / "models")))
28                other = Path(d) / "elsewhere"
29                other.mkdir()
30                self.assertIn("system folder", folders.problem(str(other / "models"))[0])
31
32
33if __name__ == "__main__":
34    unittest.main()