Commit 97001fc6 authored by Jan Kiene's avatar Jan Kiene
Browse files

make config dump take into account modifications to the config

parent 1baedaf7
Loading
Loading
Loading
Loading
+3 −4
Original line number Diff line number Diff line
@@ -104,13 +104,11 @@ class TestConfig:
        # merge dictionaries, overriding from config file
        merge_dicts(cfg, file_cfg)
        self._validate_merged_config(cfg)
        self._dump_keys = list(cfg.keys())

        # set attributes from merged dictionary
        self.__dict__.update(cfg)

        # store the merged config for writing to file later
        self._yaml_dump = self._dump_yaml(cfg)

        # convert to Path
        self.input_path = Path(self.input_path).resolve().absolute()
        self.output_path = Path(self.output_path).resolve().absolute()
@@ -136,8 +134,9 @@ class TestConfig:
        return cfg

    def to_file(self, outfile: str|Path):
        to_dump = self._dump_yaml({k:v for k, v in self.__dict__.items() if k in self._dump_keys})
        with open(outfile, "w") as f:
            yaml.safe_dump(self._yaml_dump, f)
            yaml.safe_dump(to_dump, f)

    def _validate_file_cfg(self, cfg: dict, use_windows_codec_binaries: bool):
        """ensure configuration contains required keys"""