aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to '_pytest/tmpdir.py')
-rw-r--r--_pytest/tmpdir.py7
1 files changed, 2 insertions, 5 deletions
diff --git a/_pytest/tmpdir.py b/_pytest/tmpdir.py
index 2fd9992ccf..e46c713eb0 100644
--- a/_pytest/tmpdir.py
+++ b/_pytest/tmpdir.py
@@ -48,15 +48,12 @@ class TempdirHandler:
self.trace("finish")
def pytest_configure(config):
- config._mp = mp = monkeypatch()
+ mp = monkeypatch()
t = TempdirHandler(config)
+ config._cleanup.extend([mp.undo, t.finish])
mp.setattr(config, '_tmpdirhandler', t, raising=False)
mp.setattr(pytest, 'ensuretemp', t.ensuretemp, raising=False)
-def pytest_unconfigure(config):
- config._tmpdirhandler.finish()
- config._mp.undo()
-
def pytest_funcarg__tmpdir(request):
"""return a temporary directory path object
which is unique to each test function invocation,