summaryrefslogtreecommitdiff
path: root/testtools/tests
diff options
context:
space:
mode:
authorThomi Richards <thomir@gmail.com>2014-03-05 10:00:45 +1300
committerThomi Richards <thomir@gmail.com>2014-03-10 15:40:55 +1300
commit431aafb3ec39c7769fd83d2d5969a1875c9a8c5b (patch)
tree20987e68db5d3a874b7708d14fe501e110fae264 /testtools/tests
parent37423310ecc1da58f0aac92f33c688f4ba3e01e9 (diff)
downloadtesttools-431aafb3ec39c7769fd83d2d5969a1875c9a8c5b.tar.gz
Added failing test for python 3.4 unittest.expectedFailure decorator changes.
Diffstat (limited to 'testtools/tests')
-rw-r--r--testtools/tests/test_testcase.py22
1 files changed, 22 insertions, 0 deletions
diff --git a/testtools/tests/test_testcase.py b/testtools/tests/test_testcase.py
index 709771e..de7f6e2 100644
--- a/testtools/tests/test_testcase.py
+++ b/testtools/tests/test_testcase.py
@@ -984,6 +984,28 @@ class TestExpectedFailure(TestWithDetails):
self.assertDetailsProvided(case, "addUnexpectedSuccess",
["foo", "reason"])
+ @skipIf(not hasattr(unittest, 'expectedFailure'), 'Need py27+')
+ def test_unittest_expectedFailure_decorator_works_with_failure(self):
+ class ReferenceTest(TestCase):
+ @unittest.expectedFailure
+ def test_fails_expectedly(self):
+ self.assertEquals(1, 0)
+
+ test = ReferenceTest('test_fails_expectedly')
+ result = test.run()
+ self.assertEqual(True, result.wasSuccessful())
+
+ @skipIf(not hasattr(unittest, 'expectedFailure'), 'Need py27+')
+ def test_unittest_expectedFailure_decorator_works_with_success(self):
+ class ReferenceTest(TestCase):
+ @unittest.expectedFailure
+ def test_passes_unexpectedly(self):
+ self.assertEquals(1, 1)
+
+ test = ReferenceTest('test_passes_unexpectedly')
+ result = test.run()
+ self.assertEqual(False, result.wasSuccessful())
+
class TestUniqueFactories(TestCase):
"""Tests for getUniqueString and getUniqueInteger."""