[issue14971] (unittest) loadTestsFromName does not work on method with a decorator
Roundup Robot added the comment: New changeset 78a5de507f19 by Michael Foord in branch '2.7': Closes issue 14971. http://hg.python.org/cpython/rev/78a5de507f19 -- resolution: - fixed stage: needs patch - committed/rejected status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14971 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14971] (unittest) loadTestsFromName does not work on method with a decorator
Michael Foord added the comment: Cool, thanks! -- assignee: - michael.foord ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14971 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14971] (unittest) loadTestsFromName does not work on method with a decorator
Claudiu.Popa added the comment: The patch for Python 2.7 is pretty similar with the one provided for Python 3. -- nosy: +Claudiu.Popa Added file: http://bugs.python.org/file31386/unittest_method_name_difference_27.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14971 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14971] (unittest) loadTestsFromName does not work on method with a decorator
Changes by R. David Murray rdmur...@bitdance.com: -- nosy: +eckhardt ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14971 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14971] (unittest) loadTestsFromName does not work on method with a decorator
R. David Murray added the comment: Fixed in Python3. The 2.7 unittest code is different enough that it is not immediately obvious how to make the equivalent fix (given that it has been a while since I looked at this logic). If someone wants to work out the equivalent 2.7 patch, I will apply it. -- assignee: michael.foord - stage: - needs patch versions: -Python 3.2, Python 3.3 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14971 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14971] (unittest) loadTestsFromName does not work on method with a decorator
Roundup Robot added the comment: New changeset b17bcfadd7f3 by R David Murray in branch '3.3': #14971: Use class method name, not function.__name__, during unittest discovery. http://hg.python.org/cpython/rev/b17bcfadd7f3 New changeset 659c89275be2 by R David Murray in branch 'default': Merge #14971: Use class method name, not function.__name__, during unittest discovery. http://hg.python.org/cpython/rev/659c89275be2 -- nosy: +python-dev ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14971 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14971] (unittest) loadTestsFromName does not work on method with a decorator
Michael Foord mich...@voidspace.org.uk added the comment: Patch looks great - thanks David. -- assignee: docs@python - michael.foord ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14971 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14971] (unittest) loadTestsFromName does not work on method with a decorator
R. David Murray rdmur...@bitdance.com added the comment: Here's a patch. -- components: +Library (Lib) -Documentation keywords: +patch Added file: http://bugs.python.org/file25803/unittest_method_name_difference.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14971 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14971] (unittest) loadTestsFromName does not work on method with a decorator
New submission from Alessandro Piccione alessandro.piccione...@gmail.com: Steps to reproduce the problem. 1. Create a module (ex. name it test) 2. Create a file in it (ex. mainTest.py) with a class (ex. MainTest) derived from TestCase. 3. Create a test method in that class, (ex. test_base), prefix it with test. 4. Create a decorator (ex. clear_args) and use it on the test method 5. Create a test suite with the function loadTestsFromName of TestLoader class and make a TestRunner run it (I use a TextTestRunner). suite = unittest.TestLoader().loadTestsFromName('test.mainTest.MainTest.test_base') unittest.TextTestRunner(verbosity=2).run(suite) It is expected that the test is run (it runs without decorator). It gives an error: no such test method in class 'test.mainTest.MainTest': wrapper. wrapper is the name of the returned function in the decorator. I'm using Python 2.7.3 on Windows 7 64bit. I search loadTestsFromName decorator without results, so I decided to report as new issue. This is my first report, I admit I've not read any guide/instructions. -- components: None messages: 162015 nosy: alex.75 priority: normal severity: normal status: open title: (unittest) loadTestsFromName does not work on method with a decorator type: behavior versions: Python 2.7 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14971 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14971] (unittest) loadTestsFromName does not work on method with a decorator
R. David Murray rdmur...@bitdance.com added the comment: I don't think this is documented anywhere (and should be). I believe what you need to do is use functools.wraps on your wrapper function. -- assignee: - docs@python components: +Documentation -None nosy: +docs@python, michael.foord, r.david.murray versions: +Python 3.2, Python 3.3 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14971 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14971] (unittest) loadTestsFromName does not work on method with a decorator
Michael Foord mich...@voidspace.org.uk added the comment: Whilst functools.wraps would fix the problem it still sounds like a bug (or at the very least a reasonable feature request). -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14971 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com