summaryrefslogtreecommitdiffstats
path: root/Lib/unittest/loader.py
diff options
context:
space:
mode:
authorMichael Foord <michael@voidspace.org.uk>2013-09-08 03:34:27 (GMT)
committerMichael Foord <michael@voidspace.org.uk>2013-09-08 03:34:27 (GMT)
commit050e9e5c59f84be160d15e8357f56c7c16e44450 (patch)
treee50c732247b9c498b413e71edbaedfdecdb3c966 /Lib/unittest/loader.py
parentcb7e5fa935183ddf9aa59bca91c82a69fa689b35 (diff)
downloadcpython-050e9e5c59f84be160d15e8357f56c7c16e44450.zip
cpython-050e9e5c59f84be160d15e8357f56c7c16e44450.tar.gz
cpython-050e9e5c59f84be160d15e8357f56c7c16e44450.tar.bz2
Closes issue 14971.
unittest test discovery no longer gets confused when a function has a different __name__ than its name in the TestCase class dictionary.
Diffstat (limited to 'Lib/unittest/loader.py')
-rw-r--r--Lib/unittest/loader.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/Lib/unittest/loader.py b/Lib/unittest/loader.py
index e88f536..c6fc663 100644
--- a/Lib/unittest/loader.py
+++ b/Lib/unittest/loader.py
@@ -106,7 +106,9 @@ class TestLoader(object):
elif (isinstance(obj, types.UnboundMethodType) and
isinstance(parent, type) and
issubclass(parent, case.TestCase)):
- return self.suiteClass([parent(obj.__name__)])
+ name = parts[-1]
+ inst = parent(name)
+ return self.suiteClass([inst])
elif isinstance(obj, suite.TestSuite):
return obj
elif hasattr(obj, '__call__'):