test: create empty dirs via tmp_dir.gen()

This commit is contained in:
Alexander Schepanovski
2019-12-07 10:32:37 +01:00
parent 9b6644a97e
commit c6c67ace20
+4 -1
View File
@@ -55,7 +55,10 @@ class TmpDir(pathlib.Path):
path = (prefix or self) / name
if isinstance(contents, dict):
self._gen(contents, prefix=path)
if not contents:
makedirs(path, exist_ok=True)
else:
self._gen(contents, prefix=path)
else:
makedirs(path.parent, exist_ok=True)
if is_py2 and isinstance(contents, str):