tools/test_setup_mac: the --source test no longer runs setup.data_folder() for real
The real data_folder() moves the model files of this checkout and of the data folder named in the user's settings.json into --data-dir and saves that folder as the new data folder. With a TemporaryDirectory the models are deleted on exit and settings.json is left pointing at a deleted directory (found on the M4 and on the PC: the test wrote %APPDATA%/Strata/settings.json and ~/.config/strata/settings.json). The test is about --source, so data_folder is mocked.
This commit is contained in:
1 parent
b8ec9bbf94
commit
80bed76c8a
1 file changed
+4
@@ -261,7 +261,11 @@ class Source(unittest.TestCase):
|
||||
self.addCleanup(env.stop)
|
||||
os.environ.pop("STRATA_SOURCE", None)
|
||||
warnings = []
|
||||
# setup.data_folder() is mocked: the real one moves the model files of this checkout and of the data folder in
|
||||
# the user's settings.json into --data-dir, and saves that dir as the new data folder; with a temp dir that
|
||||
# deletes the models on exit and leaves settings.json pointing at a deleted directory
|
||||
with tempfile.TemporaryDirectory() as tmp, \
|
||||
mock.patch.object(setup, "data_folder", lambda requested: (Path(tmp), [])), \
|
||||
mock.patch("subprocess.run", fake_run(M5)), \
|
||||
mock.patch.object(setup, "warn", lambda *a, **k: warnings.append(" ".join(str(x) for x in a))), \
|
||||
mock.patch.object(setup, "say", lambda *a, **k: None), \
|
||||
|
||||
Reference in new issue
Block a user