mirror of https://github.com/python/cpython
Topical change: use 'startswith()' to identify test methods with a
given prefix rather than comparing a slice.
This commit is contained in:
parent
09fad27a29
commit
3198275ace
|
@ -46,7 +46,7 @@ SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
|
||||||
|
|
||||||
__author__ = "Steve Purcell"
|
__author__ = "Steve Purcell"
|
||||||
__email__ = "stephen_purcell at yahoo dot com"
|
__email__ = "stephen_purcell at yahoo dot com"
|
||||||
__version__ = "#Revision: 1.56 $"[11:-2]
|
__version__ = "#Revision: 1.57 $"[11:-2]
|
||||||
|
|
||||||
import time
|
import time
|
||||||
import sys
|
import sys
|
||||||
|
@ -540,7 +540,7 @@ class TestLoader:
|
||||||
"""Return a sorted sequence of method names found within testCaseClass
|
"""Return a sorted sequence of method names found within testCaseClass
|
||||||
"""
|
"""
|
||||||
def isTestMethod(attrname, testCaseClass=testCaseClass, prefix=self.testMethodPrefix):
|
def isTestMethod(attrname, testCaseClass=testCaseClass, prefix=self.testMethodPrefix):
|
||||||
return attrname[:len(prefix)] == prefix and callable(getattr(testCaseClass, attrname))
|
return attrname.startswith(prefix) and callable(getattr(testCaseClass, attrname))
|
||||||
testFnNames = filter(isTestMethod, dir(testCaseClass))
|
testFnNames = filter(isTestMethod, dir(testCaseClass))
|
||||||
for baseclass in testCaseClass.__bases__:
|
for baseclass in testCaseClass.__bases__:
|
||||||
for testFnName in self.getTestCaseNames(baseclass):
|
for testFnName in self.getTestCaseNames(baseclass):
|
||||||
|
|
Loading…
Reference in New Issue