refactor: runners and scheduler, fix path handling (#23)

This commit is contained in:
banteg
2026-01-02 14:22:59 +04:00
committed by GitHub
parent 9c59056666
commit 51cdb72d0b
11 changed files with 377 additions and 424 deletions
+15 -1
View File
@@ -2,7 +2,7 @@ from __future__ import annotations
from pathlib import Path
from takopi.utils.paths import relativize_command
from takopi.utils.paths import relativize_command, relativize_path
def test_relativize_command_rewrites_cwd_paths(tmp_path: Path) -> None:
@@ -19,3 +19,17 @@ def test_relativize_command_rewrites_equals_paths(tmp_path: Path) -> None:
command = f'rg -n --files -g "*.py" --path={base}/src'
expected = 'rg -n --files -g "*.py" --path=src'
assert relativize_command(command, base_dir=base) == expected
def test_relativize_path_ignores_sibling_prefix(tmp_path: Path) -> None:
base = tmp_path / "repo"
base.mkdir()
value = str(tmp_path / "repo2" / "file.txt")
assert relativize_path(value, base_dir=base) == value
def test_relativize_path_inside_base(tmp_path: Path) -> None:
base = tmp_path / "repo"
base.mkdir()
value = str(base / "src" / "app.py")
assert relativize_path(value, base_dir=base) == "src/app.py"