use dynamically created RUNNER_DICT
This commit is contained in:
parent
7ac62a6e80
commit
be25b7e849
4 changed files with 35 additions and 54 deletions
|
|
@ -5,7 +5,7 @@ from typing import NamedTuple
|
|||
from dotenv import dotenv_values
|
||||
|
||||
from abratest.dir_manager import DirManager
|
||||
from abratest.runner_dict import RUNNER_DICT
|
||||
from abratest.runner import Runner
|
||||
|
||||
|
||||
class EnvFile(NamedTuple):
|
||||
|
|
@ -23,9 +23,9 @@ class DependencyRule(NamedTuple):
|
|||
|
||||
|
||||
class EnvManager:
|
||||
def __init__(self, env_paths_list: list[Path]):
|
||||
def __init__(self, env_paths_list: list[Path], RUNNER_DICT: dict[str, type["Runner"]]):
|
||||
self.env_files: list[EnvFile] = self._get_env_files(env_paths_list)
|
||||
self.dependency_rules: list[DependencyRule] = self._get_dependency_rules(self.env_files)
|
||||
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)
|
||||
|
||||
@staticmethod
|
||||
|
|
@ -41,7 +41,7 @@ class EnvManager:
|
|||
return env_files
|
||||
|
||||
@staticmethod
|
||||
def _get_dependency_rules(env_files: list[EnvFile]) -> 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]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue