This issue tracker has been migrated to GitHub ,
and is currently read-only.
For more information,
see the GitHub FAQs in the Python's Developer Guide.
Created on 2013年04月11日 07:08 by eckhardt, last changed 2022年04月11日 14:57 by admin. This issue is now closed.
| Files | ||||
|---|---|---|---|---|
| File name | Uploaded | Description | Edit | |
| name_mod.py | eckhardt, 2013年04月11日 07:08 | example | ||
| Messages (2) | |||
|---|---|---|---|
| msg186549 - (view) | Author: Ulrich Eckhardt (eckhardt) | Date: 2013年04月11日 07:08 | |
When you rename a test function, you can't explicitly specify it on the commandline any more. During normal test runs, it is automatically discovered though. The error is that the old name was not found, even though the new name was specified. The attached example changes the name attached to the function (its __name__ attribute) for demonstration. The same problem occurs if you auto-generate test functions and attach them to the class, using post-processing or a metaclass. The cases all have in common that the name in the class' dict is not the same as the function's __name__, so cls.foo.__name__ is not "foo". See http://mail.python.org/pipermail/python-list/2013-April/644863.html for the initial discussion on the mailinglist. While I only tested Python 2.7 there, it also fails for 3.2 and 3.3. |
|||
| msg186557 - (view) | Author: R. David Murray (r.david.murray) * (Python committer) | Date: 2013年04月11日 12:53 | |
Well, actually, the old name *is* found, it is the new name that is not found in the class dict when unittest goes to actually run the test. This is a duplicate of issue 14971. I thought I had applied that patch, but obviously I haven't, and neither did Michael. I will fix that. |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:57:44 | admin | set | github: 61896 |
| 2013年04月11日 12:53:14 | r.david.murray | set | status: open -> closed superseder: (unittest) loadTestsFromName does not work on method with a decorator nosy: + r.david.murray messages: + msg186557 resolution: duplicate stage: resolved |
| 2013年04月11日 07:08:20 | eckhardt | create | |