"""Tests for flow.core.paths.""" from pathlib import Path from flow.core import paths def test_config_dir_ends_with_flow(): assert paths.CONFIG_DIR.name == "flow" def test_data_dir_ends_with_flow(): assert paths.DATA_DIR.name == "flow" def test_modules_dir_under_data(): assert paths.MODULES_DIR.parent == paths.DATA_DIR def test_linked_state_under_state(): assert paths.LINKED_STATE.parent == paths.STATE_DIR def test_dotfiles_flow_config_path(): expected_suffix = Path("_shared") / "flow" / ".config" / "flow" assert str(paths.DOTFILES_FLOW_CONFIG).endswith(str(expected_suffix)) def test_ensure_dirs_creates_directories(tmp_path, monkeypatch): monkeypatch.setattr(paths, "CONFIG_DIR", tmp_path / "config" / "flow") monkeypatch.setattr(paths, "DATA_DIR", tmp_path / "data" / "flow") monkeypatch.setattr(paths, "STATE_DIR", tmp_path / "state" / "flow") monkeypatch.setattr(paths, "MODULES_DIR", tmp_path / "data" / "flow" / "modules") monkeypatch.setattr(paths, "PACKAGES_DIR", tmp_path / "data" / "flow" / "packages") paths.ensure_dirs() assert (tmp_path / "config" / "flow").is_dir() assert (tmp_path / "data" / "flow" / "modules").is_dir() assert (tmp_path / "state" / "flow").is_dir()