[Pytest-commit] commit/pytest: 2 new changesets

commits-noreply at bitbucket.org commits-noreply at bitbucket.org
Fri Apr 17 12:07:28 CEST 2015


2 new commits in pytest:

https://bitbucket.org/pytest-dev/pytest/commits/69642e30e3c6/
Changeset:   69642e30e3c6
Branch:      systemexit
User:        hpk42
Date:        2015-04-17 09:47:29+00:00
Summary:     fixed regression to 2.6.4 which surfaced e.g. in lost stdout capture printing
when tests raised SystemExit.
Affected #:  3 files

diff -r e42f106823e9f453005a626744d7ac234a05938a -r 69642e30e3c63f506ec7ca00336417752f282211 CHANGELOG
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -16,6 +16,10 @@
 - Support building wheels by using environment markers for the
   requirements.  Thanks Ionel Maries Cristian.
 
+- fixed regression to 2.6.4 which surfaced e.g. in lost stdout capture printing
+  when tests raised SystemExit. Thanks Holger Krekel.
+
+
 2.7.0 (compared to 2.6.4)
 -----------------------------
 

diff -r e42f106823e9f453005a626744d7ac234a05938a -r 69642e30e3c63f506ec7ca00336417752f282211 _pytest/core.py
--- a/_pytest/core.py
+++ b/_pytest/core.py
@@ -121,7 +121,7 @@
     def __init__(self, func):
         try:
             self.result = func()
-        except Exception:
+        except BaseException:
             self.excinfo = sys.exc_info()
 
     def force_result(self, result):

diff -r e42f106823e9f453005a626744d7ac234a05938a -r 69642e30e3c63f506ec7ca00336417752f282211 testing/test_core.py
--- a/testing/test_core.py
+++ b/testing/test_core.py
@@ -607,6 +607,21 @@
         assert "m1" in str(ex.value)
         assert "test_core.py:" in str(ex.value)
 
+    @pytest.mark.parametrize("exc", [ValueError, SystemExit])
+    def test_hookwrapper_exception(self, exc):
+        l = []
+        def m1():
+            l.append("m1 init")
+            yield None
+            l.append("m1 finish")
+        m1.hookwrapper = True
+
+        def m2():
+            raise exc
+        with pytest.raises(exc):
+            MultiCall([m2, m1], {}).execute()
+        assert l == ["m1 init", "m1 finish"]
+
 
 class TestHookRelay:
     def test_happypath(self):


https://bitbucket.org/pytest-dev/pytest/commits/f61e0f6a9f49/
Changeset:   f61e0f6a9f49
Branch:      pytest-2.7
User:        flub
Date:        2015-04-17 10:07:24+00:00
Summary:     Merged in hpk42/pytest-patches/systemexit (pull request #274)

fixed regression to 2.6.4 which surfaced e.g. in lost stdout capture printing
Affected #:  3 files

diff -r 5d56a7e92fe524d72c8788916bc574ce09f575df -r f61e0f6a9f49f12278020f2007a1931e01821df3 CHANGELOG
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -16,6 +16,10 @@
 - Support building wheels by using environment markers for the
   requirements.  Thanks Ionel Maries Cristian.
 
+- fixed regression to 2.6.4 which surfaced e.g. in lost stdout capture printing
+  when tests raised SystemExit. Thanks Holger Krekel.
+
+
 2.7.0 (compared to 2.6.4)
 -----------------------------
 

diff -r 5d56a7e92fe524d72c8788916bc574ce09f575df -r f61e0f6a9f49f12278020f2007a1931e01821df3 _pytest/core.py
--- a/_pytest/core.py
+++ b/_pytest/core.py
@@ -121,7 +121,7 @@
     def __init__(self, func):
         try:
             self.result = func()
-        except Exception:
+        except BaseException:
             self.excinfo = sys.exc_info()
 
     def force_result(self, result):

diff -r 5d56a7e92fe524d72c8788916bc574ce09f575df -r f61e0f6a9f49f12278020f2007a1931e01821df3 testing/test_core.py
--- a/testing/test_core.py
+++ b/testing/test_core.py
@@ -607,6 +607,21 @@
         assert "m1" in str(ex.value)
         assert "test_core.py:" in str(ex.value)
 
+    @pytest.mark.parametrize("exc", [ValueError, SystemExit])
+    def test_hookwrapper_exception(self, exc):
+        l = []
+        def m1():
+            l.append("m1 init")
+            yield None
+            l.append("m1 finish")
+        m1.hookwrapper = True
+
+        def m2():
+            raise exc
+        with pytest.raises(exc):
+            MultiCall([m2, m1], {}).execute()
+        assert l == ["m1 init", "m1 finish"]
+
 
 class TestHookRelay:
     def test_happypath(self):

Repository URL: https://bitbucket.org/pytest-dev/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.


More information about the pytest-commit mailing list