Add a file, creating all parent directories.
(self, path, content=None)
| 201 | return out |
| 202 | |
| 203 | def add_file(self, path, content=None) -> None: |
| 204 | """Add a file, creating all parent directories.""" |
| 205 | path = os.fspath(path) |
| 206 | content = content or f'Content of {path}' |
| 207 | fpath = self._to_tmp(path) |
| 208 | fpath.parent.mkdir(parents=True, exist_ok=True) # pytype: disable=attribute-error |
| 209 | fpath.write_text(content) # pytype: disable=attribute-error |
| 210 | |
| 211 | def read_file(self, path) -> str: |
| 212 | return self._to_tmp(path).read_text() # pytype: disable=attribute-error |
no test coverage detected