1 new commit in pytest:

https://bitbucket.org/hpk42/pytest/changeset/4a015a903b16/
changeset:   4a015a903b16
user:        RonnyPfannschmidt
date:        2011-12-01 20:17:24
summary:     take the skip property of unittest cases and functions into account
affected #:  3 files

diff -r 03438e53b03b1b138dfc9756068aa7ae25097887 -r 
4a015a903b1650c15fed3c8283f67f8c46271127 CHANGELOG
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -31,6 +31,7 @@
 - fix compatibility with twisted/trial-11.1.0 use cases
 - simplify Node.listchain
 - simplify junitxml output code by relying on py.xml
+- add support for skip properties on unittest classes and functions
 
 Changes between 2.1.2 and 2.1.3
 ----------------------------------------


diff -r 03438e53b03b1b138dfc9756068aa7ae25097887 -r 
4a015a903b1650c15fed3c8283f67f8c46271127 _pytest/unittest.py
--- a/_pytest/unittest.py
+++ b/_pytest/unittest.py
@@ -46,6 +46,10 @@
     def setup(self):
         self._testcase = self.parent.obj(self.name)
         self._obj = getattr(self._testcase, self.name)
+        if hasattr(self._testcase, 'skip'):
+            pytest.skip(self._testcase.skip)
+        if hasattr(self._obj, 'skip'):
+            pytest.skip(self._obj.skip)
         if hasattr(self._testcase, 'setup_method'):
             self._testcase.setup_method(self._obj)
 


diff -r 03438e53b03b1b138dfc9756068aa7ae25097887 -r 
4a015a903b1650c15fed3c8283f67f8c46271127 testing/test_unittest.py
--- a/testing/test_unittest.py
+++ b/testing/test_unittest.py
@@ -232,6 +232,29 @@
     reprec.assertoutcome(skipped=1)
 
 
+def test_testcase_skip_property(testdir):
+    testpath = testdir.makepyfile("""
+        import unittest
+        class MyTestCase(unittest.TestCase):
+            skip = 'dont run'
+            def test_func(self):
+                pass
+        """)
+    reprec = testdir.inline_run(testpath, "-s")
+    reprec.assertoutcome(skipped=1)
+
+def test_testfunction_skip_property(testdir):
+    testpath = testdir.makepyfile("""
+        import unittest
+        class MyTestCase(unittest.TestCase):
+            def test_func(self):
+                pass
+            test_func.skip = 'dont run'
+        """)
+    reprec = testdir.inline_run(testpath, "-s")
+    reprec.assertoutcome(skipped=1)
+
+
 class TestTrialUnittest:
     def setup_class(cls):
         pytest.importorskip("twisted.trial.unittest")

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.
_______________________________________________
py-svn mailing list
py-svn@codespeak.net
http://codespeak.net/mailman/listinfo/py-svn

Reply via email to