nose-devs/nose — Issue #33: Nose doesn't honor the decorator 'unittest.expectedFailure'
Author: jpellerin
Created: 2011-12-14 15:56:09+00:00
State: open

What steps will reproduce the problem?

1. Create a unit test method and decorate with the 'decorator'
unittest.expectedFailure (introduced in Python 2.7)

2. Run the above test using 'nosetests '

3.The warning message 'RuntimeWarning: TestResult has no
addExpectedFailure method, reporting as passes RuntimeWarning)' is
reported on the console is printed

What is the expected output? What do you see instead?

When the unit test modules that has the unittests adorned with the
decorator 'unittest.expectedFailure' are invoked using 'python
.py' no warnings are printed to console. But the
invocation of same test module using nose (i.e. 'nosetests
') prints a RunTimeWarning above reported.

What version of the product are you using? On what operating system?

$ nosetests -V
nosetests-script.py version 1.0.0
OS: Windows XP SP3
Python version : 2.7

Please provide any additional information below.

Here are the detailed steps to simulate the problem scenario.

Consider a dummy class
%cat report.py

class Hello(object):

def value(self):
return 100

And the associated unittest module
(Both reside in same directory)

%cat report_tests.py

import unittest
from report import Hello

class TestReport(unittest.TestCase):

@unittest.expectedFailure
def test_value(self):
h = Hello()
self.assertEqual(10,h.value())

if __name__ == '__main__':
unittest.main()

%nosetests -V
nosetests-script.py version 1.0.0

% nosetests report_tests.py
C:\Python27\lib\unittest\case.py:327: RuntimeWarning: TestResult has no addExpectedFailure method, reporting as passes
RuntimeWarning)
.
----------------------------------------------------------------------
Ran 1 test in 0.000s

OK

%python -V
Python 2.7

%python report_tests.py
x
--------------------------------------------------------
Ran 1 test in 0.000s

OK (expected failures=1)

As the above steps indicate the test invocation doesn't thrown any
warning when launched using python but shows a warning message when
launched using nosetests.

Google Code Info:
Issue #: 428
Author: sateeshp...@gmail.com
Created On: 2011-06-14T08:42:23.000Z
Closed On: