Return a directory path object with the given name. If the directory does not yet exist, it will be created. You can use it to manage files to e.g. store/retrieve database dumps across test sessions. .. versionadded:: 7.0 :param name: Must be a
(self, name: str)
| 161 | path.mkdir(exist_ok=True, parents=True) |
| 162 | |
| 163 | def mkdir(self, name: str) -> Path: |
| 164 | """Return a directory path object with the given name. |
| 165 | |
| 166 | If the directory does not yet exist, it will be created. You can use |
| 167 | it to manage files to e.g. store/retrieve database dumps across test |
| 168 | sessions. |
| 169 | |
| 170 | .. versionadded:: 7.0 |
| 171 | |
| 172 | :param name: |
| 173 | Must be a string not containing a ``/`` separator. |
| 174 | Make sure the name contains your plugin or application |
| 175 | identifiers to prevent clashes with other cache users. |
| 176 | """ |
| 177 | path = Path(name) |
| 178 | if len(path.parts) > 1: |
| 179 | raise ValueError("name is not allowed to contain path separators") |
| 180 | res = self._cachedir.joinpath(self._CACHE_PREFIX_DIRS, path) |
| 181 | self._mkdir(res) |
| 182 | return res |
| 183 | |
| 184 | def _getvaluepath(self, key: str) -> Path: |
| 185 | return self._cachedir.joinpath(self._CACHE_PREFIX_VALUES, Path(key)) |
no test coverage detected