1 new commit in pytest:

https://bitbucket.org/hpk42/pytest/commits/248aefd13c11/
Changeset:   248aefd13c11
User:        hpk42
Date:        2013-06-10 10:09:28
Summary:     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)
Affected #:  3 files

diff -r b7cb68e2408e680812186531f7aed23d04b36711 -r 
248aefd13c111fe69c0cbe9a96c38ccf6a9c7288 CHANGELOG
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,6 +1,10 @@
 Changes between 2.3.5 and 2.4.DEV
 -----------------------------------
 
+- 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)
+
 - fix issue316 - properly reference collection hooks in docs
 
 - fix issue 308 - allow to mark/xfail/skip individual parameter sets

diff -r b7cb68e2408e680812186531f7aed23d04b36711 -r 
248aefd13c111fe69c0cbe9a96c38ccf6a9c7288 _pytest/main.py
--- a/_pytest/main.py
+++ b/_pytest/main.py
@@ -97,6 +97,7 @@
             if session._testsfailed:
                 session.exitstatus = EXIT_TESTSFAILED
     finally:
+        session.startdir.chdir()
         if initstate >= 2:
             config.hook.pytest_sessionfinish(
                 session=session,
@@ -452,6 +453,7 @@
         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:

diff -r b7cb68e2408e680812186531f7aed23d04b36711 -r 
248aefd13c111fe69c0cbe9a96c38ccf6a9c7288 testing/test_session.py
--- a/testing/test_session.py
+++ b/testing/test_session.py
@@ -226,3 +226,17 @@
     assert result.ret == 0
     result.stdout.fnmatch_lines(["*1 passed*"])
 
+def test_sessionfinish_with_start(testdir):
+    testdir.makeconftest("""
+        import os
+        l = []
+        def pytest_sessionstart():
+            l.append(os.getcwd())
+            os.chdir("..")
+
+        def pytest_sessionfinish():
+            assert l[0] == os.getcwd()
+
+    """)
+    res = testdir.runpytest("--collectonly")
+    assert res.ret == 0

Repository URL: https://bitbucket.org/hpk42/pytest/

--

This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
_______________________________________________
pytest-commit mailing list
pytest-commit@python.org
http://mail.python.org/mailman/listinfo/pytest-commit

Reply via email to