feat(paths): Add support for project-specific conductor directories
This commit is contained in:
55
tests/test_project_paths.py
Normal file
55
tests/test_project_paths.py
Normal file
@@ -0,0 +1,55 @@
|
||||
import os
|
||||
import pytest
|
||||
import tomllib
|
||||
import tomli_w
|
||||
from pathlib import Path
|
||||
from src import paths
|
||||
|
||||
def test_get_conductor_dir_default():
|
||||
paths.reset_resolved()
|
||||
# Should return default "conductor" relative to root
|
||||
expected = Path(__file__).resolve().parent.parent / "conductor"
|
||||
assert paths.get_conductor_dir() == expected
|
||||
|
||||
def test_get_conductor_dir_project_specific_no_toml(tmp_path):
|
||||
paths.reset_resolved()
|
||||
project_root = tmp_path / "my_project"
|
||||
project_root.mkdir()
|
||||
|
||||
# Should default to project_root / "conductor" if no manual_slop.toml
|
||||
res = paths.get_conductor_dir(project_path=str(project_root))
|
||||
assert res == project_root / "conductor"
|
||||
|
||||
def test_get_conductor_dir_project_specific_with_toml(tmp_path):
|
||||
paths.reset_resolved()
|
||||
project_root = tmp_path / "my_project"
|
||||
project_root.mkdir()
|
||||
|
||||
# Create manual_slop.toml with custom conductor dir
|
||||
toml_path = project_root / "manual_slop.toml"
|
||||
config = {
|
||||
"conductor": {
|
||||
"dir": "custom_tracks"
|
||||
}
|
||||
}
|
||||
with open(toml_path, "wb") as f:
|
||||
f.write(tomli_w.dumps(config).encode())
|
||||
|
||||
res = paths.get_conductor_dir(project_path=str(project_root))
|
||||
assert res == project_root / "custom_tracks"
|
||||
|
||||
def test_get_tracks_dir_project_specific(tmp_path):
|
||||
paths.reset_resolved()
|
||||
project_root = tmp_path / "my_project"
|
||||
project_root.mkdir()
|
||||
|
||||
res = paths.get_tracks_dir(project_path=str(project_root))
|
||||
assert res == project_root / "conductor" / "tracks"
|
||||
|
||||
def test_get_track_state_dir_project_specific(tmp_path):
|
||||
paths.reset_resolved()
|
||||
project_root = tmp_path / "my_project"
|
||||
project_root.mkdir()
|
||||
|
||||
res = paths.get_track_state_dir("track-123", project_path=str(project_root))
|
||||
assert res == project_root / "conductor" / "tracks" / "track-123"
|
||||
Reference in New Issue
Block a user