[Pytest-commit] commit/pytest: hpk42: fix issue322: tearDownClass is not run if setUpClass failed. Thanks

commits-noreply at bitbucket.org commits-noreply at bitbucket.org
Fri Aug 2 00:02:40 CEST 2013


1 new commit in pytest:

https://bitbucket.org/hpk42/pytest/commits/44f1eaaf106f/
Changeset:   44f1eaaf106f
User:        hpk42
Date:        2013-08-02 00:02:28
Summary:     fix issue322: tearDownClass is not run if setUpClass failed. Thanks
Mathieu Agopian for fixing.  The patch moves handling setUpClass
into a new autofixture. (XXX impl-decide if rather adding addfinalizer()
API to node's would have a similar effect)
Affected #:  2 files

diff -r 4f2b83a6082cffe3ddec003703480611b9f5062b -r 44f1eaaf106f677b20f1c0fb6220fe198d9164ed CHANGELOG
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,6 +1,11 @@
 Changes between 2.3.5 and 2.4.DEV
 -----------------------------------
 
+- fix issue322: tearDownClass is not run if setUpClass failed. Thanks
+  Mathieu Agopian for fixing.  The patch moves handling setUpClass
+  into a new autofixture. (XXX impl-decide if rather adding addfinalizer()
+  API to node's would have a similar effect)
+
 - fix issue336: autouse fixture in plugins should work again.
 
 - change to use hyphen-separated long options but keep the old spelling

diff -r 4f2b83a6082cffe3ddec003703480611b9f5062b -r 44f1eaaf106f677b20f1c0fb6220fe198d9164ed _pytest/unittest.py
--- a/_pytest/unittest.py
+++ b/_pytest/unittest.py
@@ -28,7 +28,8 @@
         return  # skipped
     setup = getattr(request.cls, 'setUpClass', None)
     teardown = getattr(request.cls, 'tearDownClass', None)
-    setup()
+    if setup is not None:
+        setup()
     if teardown is not None:
         request.addfinalizer(teardown)

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.


More information about the pytest-commit mailing list