diff --git a/pyrelacs/repros/repros.py b/pyrelacs/repros/repros.py index f1bd258..89171cb 100644 --- a/pyrelacs/repros/repros.py +++ b/pyrelacs/repros/repros.py @@ -4,6 +4,7 @@ import ast import pathlib from IPython import embed +import nixio as nix from pyrelacs.util.logging import config_logging log = config_logging() @@ -13,22 +14,24 @@ class Repro: def __init__(self) -> None: pass - def run_repro(self, name: str, file: pathlib.Path, *args, **kwargs) -> None: + def run_repro( + self, nix_file: nix.File, name: str, file: pathlib.Path, *args, **kwargs + ) -> None: spec = importlib.util.spec_from_file_location("rep", file) if not spec: - log.error("Could not load the repro") + log.error("Could not load the file") else: module = importlib.util.module_from_spec(spec) if not module: - log.error("Could not load Class of the repro") + log.error("Could not load the module of the repro") else: sys.modules[name] = module spec.loader.exec_module(module) if hasattr(module, name): rep_class = getattr(module, name) - rep_class.run() + rep_class.run(nix_file) else: - raise AttributeError(f"{name} has no run function") + raise AttributeError(f"{file.name} has no {name} class") def names_of_repros(self): file_path_cur = pathlib.Path(__file__).parent