Message215240
In Python 2.7 and 3.3, decorating a unittest.TestCase subclass with unittest.expectedFailure caused test discover to skip the decorated test case. Python 3.4 apparently ignores the decorator when applied to classes.
The attached file when run with Python 2.7.6 on Mac OS X produces the following output
$ python -m unittest discover
F.
======================================================================
FAIL: test_fails (test.TestControl)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/Users/schwartz_w/Documents/testtest/test.py", line 9, in test_fails
self.assertFalse(True)
AssertionError: True is not false
----------------------------------------------------------------------
Ran 2 tests in 0.000s
FAILED (failures=1)
When run with Python 3.4.0 produces the following output.
~/Documents/testtest $ python3 -m unittest discover
F.F.
======================================================================
FAIL: test_fails (test.TestControl)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/Users/schwartz_w/Documents/testtest/test.py", line 9, in test_fails
self.assertFalse(True)
AssertionError: True is not false
======================================================================
FAIL: test_fails (test.TestTreatment)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/Users/schwartz_w/Documents/testtest/test.py", line 9, in test_fails
self.assertFalse(True)
AssertionError: True is not false
----------------------------------------------------------------------
Ran 4 tests in 0.001s
FAILED (failures=2)
The expectedFailure decorator when applied to a class should either skip the class or run all of its tests and check that they failed for consistency with how expectedFailure applies to test methods. |
|
Date |
User |
Action |
Args |
2014-03-31 14:20:26 | William.Schwartz | set | recipients:
+ William.Schwartz |
2014-03-31 14:20:26 | William.Schwartz | set | messageid: <1396275626.74.0.920741880392.issue21112@psf.upfronthosting.co.za> |
2014-03-31 14:20:26 | William.Schwartz | link | issue21112 messages |
2014-03-31 14:20:26 | William.Schwartz | create | |
|