remove RunnerMeta, save path to class var instead

This commit is contained in:
Daniel 2023-12-11 00:00:16 +01:00
parent 7ec75cd6a0
commit edc8c9a2f5
3 changed files with 12 additions and 19 deletions

View file

@ -5,7 +5,6 @@ from typing import TYPE_CHECKING, NamedTuple
from dotenv import dotenv_values
if TYPE_CHECKING:
from pytest_abra.coordinator import RunnerMeta
from pytest_abra.dir_manager import DirManager
from pytest_abra.runner import Runner
@ -25,7 +24,7 @@ class DependencyRule(NamedTuple):
class EnvManager:
def __init__(self, env_paths: list[Path], RUNNER_DICT: dict[str, "RunnerMeta"]):
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.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)
@ -43,10 +42,10 @@ class EnvManager:
return env_files
@staticmethod
def _get_dependency_rules(env_files: list[EnvFile], RUNNER_DICT: dict[str, "RunnerMeta"]) -> list[DependencyRule]:
def _get_dependency_rules(env_files: list[EnvFile], RUNNER_DICT: dict[str, type[Runner]]) -> list[DependencyRule]:
dependency_rules: list[DependencyRule] = []
for env_file in env_files:
child_runner_class = RUNNER_DICT[env_file.env_type].cls
child_runner_class = RUNNER_DICT[env_file.env_type]
for dependency in child_runner_class.dependencies:
dependency_rule = DependencyRule(child=child_runner_class.env_type, dependency=dependency)
dependency_rules.append(dependency_rule)