MCPcopy
hub / github.com/pytest-dev/pytest / mkdir

Method mkdir

src/_pytest/cacheprovider.py:163–182  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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))

Callers 2

_make_cachedirFunction · 0.45
_mkdirMethod · 0.45

Calls 1

_mkdirMethod · 0.95

Tested by

no test coverage detected