MCPcopy Create free account
hub / github.com/pytest-dev/pytest / mkdir

Method mkdir

src/_pytest/cacheprovider.py:122–141  ·  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

120 )
121
122 def mkdir(self, name: str) -> Path:
123 """Return a directory path object with the given name.
124
125 If the directory does not yet exist, it will be created. You can use
126 it to manage files to e.g. store/retrieve database dumps across test
127 sessions.
128
129 .. versionadded:: 7.0
130
131 :param name:
132 Must be a string not containing a ``/`` separator.
133 Make sure the name contains your plugin or application
134 identifiers to prevent clashes with other cache users.
135 """
136 path = Path(name)
137 if len(path.parts) > 1:
138 raise ValueError("name is not allowed to contain path separators")
139 res = self._cachedir.joinpath(self._CACHE_PREFIX_DIRS, path)
140 res.mkdir(exist_ok=True, parents=True)
141 return res
142
143 def _getvaluepath(self, key: str) -> Path:
144 return self._cachedir.joinpath(self._CACHE_PREFIX_VALUES, Path(key))

Callers 1

setMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected