Commit 10ded0d6 authored by Jan Kiene's avatar Jan Kiene
Browse files

fix yaml dump of paths

parent 7a063a3e
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -119,14 +119,14 @@ class TestConfig:
            return yaml.safe_load(fp)

    def _dump_yaml(self, cfg: dict):
        """convert objects to to strings to avoid YAML dump as object"""
        """convert Path objects to strings to avoid YAML dump as object"""
        cfg = deepcopy(cfg)

        def format(d: dict):
            for k, v in d.items():
                if isinstance(v, dict):
                    format(v)
                else:
                elif isinstance(v, Path):
                    d[k] = str(v)

        format(cfg)
@@ -136,7 +136,7 @@ class TestConfig:
    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(to_dump, f)
            yaml.dump(to_dump, f)

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