[New-bugs-announce] [issue14971] (unittest) loadTestsFromName does not work on method with a decorator
Alessandro Piccione
report at bugs.python.org
Thu May 31 21:02:19 CEST 2012
New submission from Alessandro Piccione <alessandro.piccione.75 at 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 <report at bugs.python.org>
<http://bugs.python.org/issue14971>
_______________________________________
More information about the New-bugs-announce
mailing list