diff --git a/CHANGELOG b/CHANGELOG index 8089581af..2aa520c4c 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -9,6 +9,7 @@ Changes between 2.2.1 and 2.2.2.dev test directory was renamed and some pyc/__pycache__ remain - fix issue106: allow parametrize to be applied multiple times e.g. from module, class and at function level. +- add chdir method to monkeypatch funcarg Changes between 2.2.0 and 2.2.1 ---------------------------------------- diff --git a/_pytest/monkeypatch.py b/_pytest/monkeypatch.py index c2d27ff33..862904431 100644 --- a/_pytest/monkeypatch.py +++ b/_pytest/monkeypatch.py @@ -13,6 +13,7 @@ def pytest_funcarg__monkeypatch(request): monkeypatch.setenv(name, value, prepend=False) monkeypatch.delenv(name, value, raising=True) monkeypatch.syspath_prepend(path) + monkeypatch.chdir(path) All modifications will be undone after the requesting test function has finished. The ``raising`` @@ -85,6 +86,9 @@ class monkeypatch: sys.path.insert(0, str(path)) def chdir(self, path): + """ change the current working directory to the specified path + path can be a string or a py.path.local object + """ if self._cwd is None: self._cwd = os.getcwd() if hasattr(path, "chdir"):