classification
Title: unittest.expectedFailure decorator does not maintain target function's docstring.
Type: performance Stage:
Components: Tests Versions: Python 3.2
process
Status: closed Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: mark.smith, michael.foord, r.david.murray
Priority: normal Keywords: patch

Created on 2010-08-02 12:43 by mark.smith, last changed 2010-08-02 14:04 by r.david.murray. This issue is now closed.

Messages (5)
msg112457 - (view) Author: Mark Smith (mark.smith) * Date: 2010-08-02 12:43
When running tests with -v, the test runner prints out the docstring of each test method, if present, and falls back to the method name if it's not present.

Test methods wrapped with @expectedFailure do not print out their docstring, so it looks like the docstring is not copied to the wrapper function.

Failing test coming soon, hopefully followed by a patch to fix :)
msg112459 - (view) Author: Mark Smith (mark.smith) * Date: 2010-08-02 12:52
Provided a patch to demonstrate this issue.

Demonstrates that docstrings aren't copied to the decorator function.
msg112461 - (view) Author: Mark Smith (mark.smith) * Date: 2010-08-02 13:20
Removed the failing test patch, because it didn't demonstrate what I thought it did. Unwrapped tests also don't have docstrings, because they are instances of the TestCase, not references to the function.
msg112465 - (view) Author: Mark Smith (mark.smith) * Date: 2010-08-02 13:29
Closed this issue. The initial report was in error -- it turns out I can't even read my own console. I'm an idiot :)
msg112470 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2010-08-02 14:04
Woops, sorry for making you nosy on a closed issue, Michael.  Apparently I can't read either.
History
Date User Action Args
2010-08-02 14:04:43r.david.murraysetnosy: + r.david.murray
messages: + msg112470
2010-08-02 14:03:35r.david.murraysetnosy: + michael.foord
2010-08-02 13:29:08mark.smithsetstatus: open -> closed

messages: + msg112465
2010-08-02 13:20:19mark.smithsetmessages: + msg112461
2010-08-02 13:19:04mark.smithsetfiles: - unittest_failing_test.patch
2010-08-02 12:52:32mark.smithsetfiles: + unittest_failing_test.patch
keywords: + patch
messages: + msg112459
2010-08-02 12:43:26mark.smithcreate