fix: root path for tests
All checks were successful
build / build (push) Successful in 2m23s

This commit is contained in:
张泊明518370910136 2025-02-27 01:28:43 -05:00
parent ae77fa23b5
commit aee123601f
GPG Key ID: D47306D7062CDA9D

View File

@ -11,15 +11,15 @@ from joj3_config_generator.models import repo, task
def read_convert_files(
case_name: str,
) -> Tuple[repo.Config, task.Config, Dict[str, Any]]:
root = Path(__file__).resolve().parent
repo_toml_path = root / case_name / "repo.toml"
root = Path(__file__).resolve().parent / case_name
repo_toml_path = root / "repo.toml"
repo_toml = repo_toml_path.read_text() if repo_toml_path.exists() else ""
task_toml_path = root / case_name / "task.toml"
task_toml_path = root / "task.toml"
task_toml = task_toml_path.read_text() if task_toml_path.exists() else ""
result = json.loads((root / case_name / "task.json").read_text())
result = json.loads((root / "task.json").read_text())
return (
repo.Config(**rtoml.loads(repo_toml)),
task.Config(**rtoml.loads(task_toml)),
repo.Config(root=root, **rtoml.loads(repo_toml)),
task.Config(root=root, **rtoml.loads(task_toml)),
result,
)