"""Tests for flow.core.paths.""" from pathlib import Path from flow.core.paths import ( CONFIG_DIR, CONFIG_FILE, DATA_DIR, DOTFILES_DIR, INSTALLED_STATE, LINKED_STATE, MANIFEST_FILE, PACKAGES_DIR, SCRATCH_DIR, STATE_DIR, ensure_dirs, ) def test_config_dir_under_home(): assert ".config/devflow" in str(CONFIG_DIR) def test_data_dir_under_home(): assert ".local/share/devflow" in str(DATA_DIR) def test_state_dir_under_home(): assert ".local/state/devflow" in str(STATE_DIR) def test_manifest_file_in_config_dir(): assert MANIFEST_FILE == CONFIG_DIR / "manifest.yaml" def test_config_file_in_config_dir(): assert CONFIG_FILE == CONFIG_DIR / "config" def test_dotfiles_dir(): assert DOTFILES_DIR == DATA_DIR / "dotfiles" def test_packages_dir(): assert PACKAGES_DIR == DATA_DIR / "packages" def test_scratch_dir(): assert SCRATCH_DIR == DATA_DIR / "scratch" def test_state_files(): assert LINKED_STATE == STATE_DIR / "linked.json" assert INSTALLED_STATE == STATE_DIR / "installed.json" def test_ensure_dirs(tmp_path, monkeypatch): monkeypatch.setattr("flow.core.paths.CONFIG_DIR", tmp_path / "config") monkeypatch.setattr("flow.core.paths.DATA_DIR", tmp_path / "data") monkeypatch.setattr("flow.core.paths.STATE_DIR", tmp_path / "state") monkeypatch.setattr("flow.core.paths.PACKAGES_DIR", tmp_path / "data" / "packages") monkeypatch.setattr("flow.core.paths.SCRATCH_DIR", tmp_path / "data" / "scratch") ensure_dirs() assert (tmp_path / "config").is_dir() assert (tmp_path / "data").is_dir() assert (tmp_path / "state").is_dir() assert (tmp_path / "data" / "packages").is_dir() assert (tmp_path / "data" / "scratch").is_dir()