New submission from William Schwartz:

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.

----------
components: Library (Lib)
files: test_expectedFailure.py
messages: 215240
nosy: William.Schwartz
priority: normal
severity: normal
status: open
title: 3.4 regression: unittest.expectedFailure no longer works on TestCase 
subclasses
type: behavior
versions: Python 3.4
Added file: http://bugs.python.org/file34680/test_expectedFailure.py

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue21112>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to