summaryrefslogtreecommitdiffstats
path: root/Lib/unittest/test
diff options
context:
space:
mode:
authorAntoine Pitrou <solipsis@pitrou.net>2012-04-25 12:58:17 (GMT)
committerAntoine Pitrou <solipsis@pitrou.net>2012-04-25 12:58:17 (GMT)
commitf99983dacb509125f53358496c4fee9eaf2e67e8 (patch)
treef7ca15e455a070a0d53b1b722e9f85bcf3a75684 /Lib/unittest/test
parentd0bb6aa27507fede6cde3e536bd5edec5cd5dfa4 (diff)
parentb05ac864f048bfeb184e93be71aebd6223a76eec (diff)
downloadcpython-f99983dacb509125f53358496c4fee9eaf2e67e8.zip
cpython-f99983dacb509125f53358496c4fee9eaf2e67e8.tar.gz
cpython-f99983dacb509125f53358496c4fee9eaf2e67e8.tar.bz2
Issue #14664: It is now possible to use @unittest.skip{If,Unless} on a test class that doesn't inherit from TestCase (i.e. a mixin).
Diffstat (limited to 'Lib/unittest/test')
-rw-r--r--Lib/unittest/test/test_skipping.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/Lib/unittest/test/test_skipping.py b/Lib/unittest/test/test_skipping.py
index b592464..952240e 100644
--- a/Lib/unittest/test/test_skipping.py
+++ b/Lib/unittest/test/test_skipping.py
@@ -66,6 +66,21 @@ class Test_TestSkipping(unittest.TestCase):
self.assertEqual(result.skipped, [(test, "testing")])
self.assertEqual(record, [])
+ def test_skip_non_unittest_class(self):
+ @unittest.skip("testing")
+ class Mixin:
+ def test_1(self):
+ record.append(1)
+ class Foo(Mixin, unittest.TestCase):
+ pass
+ record = []
+ result = unittest.TestResult()
+ test = Foo("test_1")
+ suite = unittest.TestSuite([test])
+ suite.run(result)
+ self.assertEqual(result.skipped, [(test, "testing")])
+ self.assertEqual(record, [])
+
def test_expected_failure(self):
class Foo(unittest.TestCase):
@unittest.expectedFailure