add optional `new_path` argument to `Pytester.chdir`
This commit is contained in:
parent
9454fc38d3
commit
86a60250c2
|
@ -750,11 +750,16 @@ class Pytester:
|
||||||
self._request.addfinalizer(reprec.finish_recording)
|
self._request.addfinalizer(reprec.finish_recording)
|
||||||
return reprec
|
return reprec
|
||||||
|
|
||||||
def chdir(self) -> None:
|
def chdir(self, new_path: Optional[Path] = None) -> None:
|
||||||
"""Cd into the temporary directory.
|
"""Cd into the temporary directory.
|
||||||
|
|
||||||
This is done automatically upon instantiation.
|
This is done automatically upon instantiation.
|
||||||
|
|
||||||
|
:param new_path:
|
||||||
|
Optionally specify a different path to cd into
|
||||||
"""
|
"""
|
||||||
|
if new_path:
|
||||||
|
self._path = new_path
|
||||||
self._monkeypatch.chdir(self.path)
|
self._monkeypatch.chdir(self.path)
|
||||||
|
|
||||||
def _makefile(
|
def _makefile(
|
||||||
|
|
Loading…
Reference in New Issue