"""A config that names its own database writes nothing to the home folder. The v2 app gives the brain a config (``JARVIS_CONFIG_PATH``) whose ``db_path`` is inside the app's data folder (app/src/admin.spec.md, "LLM"); loading it must not create the default ``~/.local/share/jarvis`` folder as a side effect. """ import json from jarvis.config import load_settings def test_an_own_db_path_leaves_the_home_folder_alone(tmp_path, monkeypatch): home = tmp_path / "home" home.mkdir() monkeypatch.setenv("HOME", str(home)) monkeypatch.setenv("USERPROFILE", str(home)) data = tmp_path / "data" cfg = data / "config" / "brain.json" cfg.parent.mkdir(parents=True) db = data / "memory" / "jarvis.db" cfg.write_text(json.dumps({"db_path": str(db), "_config_version": 1}), encoding="utf-8") monkeypatch.setenv("JARVIS_CONFIG_PATH", str(cfg)) settings = load_settings() assert settings.db_path == str(db) assert list(home.iterdir()) == []