JOJ3-config-generator/tests/conftest.py
张泊明518370910136 8bf0f7cfff
All checks were successful
build / build (push) Successful in 1m3s
feat: LLM generated convert function
2024-10-20 04:46:41 -04:00

24 lines
836 B
Python

import os
from typing import Any
import pytest
from joj3_config_generator.models import Repo, Task
from tests.utils import read_convert_files
def get_test_cases() -> list[tuple[str, Repo, Task, dict[str, Any]]]:
test_cases = []
tests_dir = os.path.dirname(os.path.realpath(__file__))
for dir_name in os.listdir(tests_dir):
dir_path = os.path.join(tests_dir, dir_name)
if os.path.isdir(dir_path) and dir_name != "__pycache__":
repo, task, expected_result = read_convert_files(dir_path)
test_cases.append((dir_name, repo, task, expected_result))
return test_cases
@pytest.fixture(params=get_test_cases(), ids=lambda x: x[0])
def test_case(request: pytest.FixtureRequest) -> tuple[Repo, Task, dict[str, Any]]:
return request.param[1:] # return repo, task, expected_result