MCPcopy Create free account
hub / github.com/Exiv2/exiv2 / MyTestLoader

Class MyTestLoader

tests/runner.py:14–33  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

12
13
14class MyTestLoader(unittest.TestLoader):
15 testNamePatterns = None
16
17 def getTestCaseNames(self, testCaseClass):
18 """
19 Customize this code to allow you to filter test methods through testNamePatterns.
20 """
21 def shouldIncludeMethod(attrname):
22 if not attrname.startswith(self.testMethodPrefix):
23 return False
24 testFunc = getattr(testCaseClass, attrname)
25 if not callable(testFunc):
26 return False
27 return self.testNamePatterns is None or \
28 any(fnmatchcase(attrname, pattern) for pattern in self.testNamePatterns)
29
30 testFnNames = list(filter(shouldIncludeMethod, dir(testCaseClass)))
31 if self.sortTestMethodsUsing:
32 testFnNames.sort(key=functools.cmp_to_key(self.sortTestMethodsUsing))
33 return testFnNames
34
35
36if __name__ == '__main__':

Callers 1

runner.pyFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected