[repro/class] provides with repros with args and kwargs

This commit is contained in:
wendtalexander 2024-10-23 11:07:55 +02:00
parent 02911e57f8
commit 75619cf1c8

View File

@ -22,9 +22,7 @@ class Repro:
def __init__(self) -> None: def __init__(self) -> None:
pass pass
def run_repro( def run_repro(self, name: str, file: pathlib.Path, *args, **kwargs) -> None:
self, nix_file: nix.File, name: str, file: pathlib.Path, *args, **kwargs
) -> None:
spec = importlib.util.spec_from_file_location("rep", file) spec = importlib.util.spec_from_file_location("rep", file)
if not spec: if not spec:
log.error("Could not load the file") log.error("Could not load the file")
@ -40,7 +38,7 @@ class Repro:
log.error(f"{spec.loader} is None") log.error(f"{spec.loader} is None")
if hasattr(module, name): if hasattr(module, name):
rep_class = getattr(module, name) rep_class = getattr(module, name)
rep_class.run(nix_file) rep_class.run(*args, **kwargs)
else: else:
raise AttributeError(f"{file.name} has no {name} class") raise AttributeError(f"{file.name} has no {name} class")