testFunc = getattr(testCaseClass, attrname)
if not callable(testFunc):
return False
- fullName = '%s.%s' % (testCaseClass.__module__, testFunc.__qualname__)
+ fullName = f'%s.%s.%s' % (
+ testCaseClass.__module__, testCaseClass.__qualname__, attrname
+ )
return self.testNamePatterns is None or \
any(fnmatchcase(fullName, pattern) for pattern in self.testNamePatterns)
testFnNames = list(filter(shouldIncludeMethod, dir(testCaseClass)))
+import functools
import sys
import types
import warnings
self.assertIs(loader.suiteClass, unittest.TestSuite)
+ def test_partial_functions(self):
+ def noop(arg):
+ pass
+
+ class Foo(unittest.TestCase):
+ pass
+
+ setattr(Foo, 'test_partial', functools.partial(noop, None))
+
+ loader = unittest.TestLoader()
+
+ test_names = ['test_partial']
+ self.assertEqual(loader.getTestCaseNames(Foo), test_names)
+
+
if __name__ == "__main__":
unittest.main()