make sessionfinish hooks execute with the same cwd-context as at

session start (helps fix plugin behaviour which write output files
with relative path such as pytest-cov)
This commit is contained in:
holger krekel
2013-06-10 10:09:28 +02:00
parent 2951c3ace9
commit ac3d8800fd
3 changed files with 20 additions and 0 deletions

View File

@@ -97,6 +97,7 @@ def wrap_session(config, doit):
if session._testsfailed:
session.exitstatus = EXIT_TESTSFAILED
finally:
session.startdir.chdir()
if initstate >= 2:
config.hook.pytest_sessionfinish(
session=session,
@@ -452,6 +453,7 @@ class Session(FSCollector):
self.shouldstop = False
self.trace = config.trace.root.get("collection")
self._norecursepatterns = config.getini("norecursedirs")
self.startdir = py.path.local()
def pytest_collectstart(self):
if self.shouldstop: