Commit 3fec3c30 authored by Jan Kiene's avatar Jan Kiene
Browse files

write config in current state, not in the initial state

parent 528603ee
Loading
Loading
Loading
Loading
+5 −3
Original line number Diff line number Diff line
@@ -108,8 +108,8 @@ class TestConfig:
        # 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)
        # store keys from merged config for later writing to file
        self._keys_to_dump = list( cfg.keys() )

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

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

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