Commits

Ronny Pfannschmidt committed 9a47295

tests for the unittest skip properties

Comments (0)

Files changed (1)

unittest-skip-property

 # HG changeset patch
-# Parent ae08212f91afae3f2ee0320df72a51c3e188989a
+# Parent 1a54c6ab1017f56dab5086ae282301943baf33d3
+take the skip property of unittest cases and functions into account
+
 diff --git a/_pytest/unittest.py b/_pytest/unittest.py
 --- a/_pytest/unittest.py
 +++ b/_pytest/unittest.py
          if hasattr(self._testcase, 'setup_method'):
              self._testcase.setup_method(self._obj)
  
+diff --git a/testing/test_unittest.py b/testing/test_unittest.py
+--- a/testing/test_unittest.py
++++ b/testing/test_unittest.py
+@@ -232,6 +232,29 @@ def test_module_level_pytestmark(testdir
+     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")