fixup
This commit is contained in:
parent
edc8c9a2f5
commit
de6a71b9c8
3 changed files with 7 additions and 7 deletions
|
|
@ -109,6 +109,6 @@ class Coordinator:
|
||||||
assert len(runner_class_names) == 1
|
assert len(runner_class_names) == 1
|
||||||
runner_class_name = runner_class_names[0]
|
runner_class_name = runner_class_names[0]
|
||||||
RunnerClass: type[Runner] = getattr(module, runner_class_name)
|
RunnerClass: type[Runner] = getattr(module, runner_class_name)
|
||||||
RunnerClass._tests_path = module_path
|
RunnerClass._tests_path = module_path.parent
|
||||||
RUNNER_DICT[RunnerClass.env_type] = RunnerClass
|
RUNNER_DICT[RunnerClass.env_type] = RunnerClass
|
||||||
return RUNNER_DICT
|
return RUNNER_DICT
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@ class DependencyRule(NamedTuple):
|
||||||
|
|
||||||
|
|
||||||
class EnvManager:
|
class EnvManager:
|
||||||
def __init__(self, env_paths: list[Path], RUNNER_DICT: dict[str, type[Runner]]):
|
def __init__(self, env_paths: list[Path], RUNNER_DICT: dict[str, type["Runner"]]):
|
||||||
self.env_files: list[EnvFile] = self._get_env_files(env_paths)
|
self.env_files: list[EnvFile] = self._get_env_files(env_paths)
|
||||||
self.dependency_rules: list[DependencyRule] = self._get_dependency_rules(self.env_files, RUNNER_DICT)
|
self.dependency_rules: list[DependencyRule] = self._get_dependency_rules(self.env_files, RUNNER_DICT)
|
||||||
self.env_files = self.sort_env_files_by_rule(self.env_files, self.dependency_rules)
|
self.env_files = self.sort_env_files_by_rule(self.env_files, self.dependency_rules)
|
||||||
|
|
@ -42,7 +42,7 @@ class EnvManager:
|
||||||
return env_files
|
return env_files
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def _get_dependency_rules(env_files: list[EnvFile], RUNNER_DICT: dict[str, type[Runner]]) -> list[DependencyRule]:
|
def _get_dependency_rules(env_files: list[EnvFile], RUNNER_DICT: dict[str, type["Runner"]]) -> list[DependencyRule]:
|
||||||
dependency_rules: list[DependencyRule] = []
|
dependency_rules: list[DependencyRule] = []
|
||||||
for env_file in env_files:
|
for env_file in env_files:
|
||||||
child_runner_class = RUNNER_DICT[env_file.env_type]
|
child_runner_class = RUNNER_DICT[env_file.env_type]
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
import os
|
import os
|
||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import TYPE_CHECKING, Callable, NamedTuple, Optional
|
from typing import TYPE_CHECKING, Callable, NamedTuple
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
from loguru import logger
|
from loguru import logger
|
||||||
|
|
@ -31,7 +31,7 @@ class Runner:
|
||||||
tests: list[Test] = []
|
tests: list[Test] = []
|
||||||
cleanups: list[Test] = []
|
cleanups: list[Test] = []
|
||||||
dependencies: list[str] = []
|
dependencies: list[str] = []
|
||||||
_tests_path: Optional[Path] = None
|
_tests_path: Path = Path("undefined")
|
||||||
|
|
||||||
def __init__(self, coordinator: "Coordinator", runner_index: int):
|
def __init__(self, coordinator: "Coordinator", runner_index: int):
|
||||||
self.coordinator = coordinator
|
self.coordinator = coordinator
|
||||||
|
|
@ -74,7 +74,7 @@ class Runner:
|
||||||
|
|
||||||
identifier_string = self.combine_names(self.env_type, test.test_file)
|
identifier_string = self.combine_names(self.env_type, test.test_file)
|
||||||
|
|
||||||
results = list(self.DIR.RECIPES.rglob(test.test_file))
|
results = list(self._tests_path.rglob(test.test_file))
|
||||||
assert len(results) == 1, f"{test.test_file} should exist exactly 1 time, but found {len(results)} times"
|
assert len(results) == 1, f"{test.test_file} should exist exactly 1 time, but found {len(results)} times"
|
||||||
full_test_path = results[0]
|
full_test_path = results[0]
|
||||||
|
|
||||||
|
|
@ -201,7 +201,7 @@ class Runner:
|
||||||
passed_tests = [r.name for r in self.DIR.RESULTS.glob("*") if "passed" in r.name]
|
passed_tests = [r.name for r in self.DIR.RESULTS.glob("*") if "passed" in r.name]
|
||||||
results = []
|
results = []
|
||||||
for dependency in self.dependencies:
|
for dependency in self.dependencies:
|
||||||
dependency_runner = self.coordinator.RUNNER_DICT[dependency].cls
|
dependency_runner = self.coordinator.RUNNER_DICT[dependency]
|
||||||
for setup_name in dependency_runner.setups:
|
for setup_name in dependency_runner.setups:
|
||||||
dependencie_identifier = self.combine_names(dependency_runner.env_type, setup_name.test_file)
|
dependencie_identifier = self.combine_names(dependency_runner.env_type, setup_name.test_file)
|
||||||
results.append(any(dependencie_identifier in f for f in passed_tests))
|
results.append(any(dependencie_identifier in f for f in passed_tests))
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue