mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
Enable unittest.TestCase to be instantiated without providing a method name.
Changed unittestgui to show number of discovered tests in the status bar.
This commit is contained in:
parent
faa8c13ef4
commit
32e1d8340c
5 changed files with 30 additions and 5 deletions
|
@ -274,12 +274,17 @@ class TestCase(object):
|
|||
"""
|
||||
self._testMethodName = methodName
|
||||
self._outcomeForDoCleanups = None
|
||||
self._testMethodDoc = 'No test'
|
||||
try:
|
||||
testMethod = getattr(self, methodName)
|
||||
except AttributeError:
|
||||
raise ValueError("no such test method in %s: %s" %
|
||||
(self.__class__, methodName))
|
||||
self._testMethodDoc = testMethod.__doc__
|
||||
if methodName != 'runTest':
|
||||
# we allow instantiation with no explicit method name
|
||||
# but not an *incorrect* or missing method name
|
||||
raise ValueError("no such test method in %s: %s" %
|
||||
(self.__class__, methodName))
|
||||
else:
|
||||
self._testMethodDoc = testMethod.__doc__
|
||||
self._cleanups = []
|
||||
|
||||
# Map types to custom assertEqual functions that will compare
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue