unittest: issue 8301. Adding functions to test suites no longer crashes.
diff --git a/Lib/unittest/suite.py b/Lib/unittest/suite.py
index 0dd2dc5..cf6d94a 100644
--- a/Lib/unittest/suite.py
+++ b/Lib/unittest/suite.py
@@ -119,7 +119,12 @@
if getattr(currentClass, "__unittest_skip__", False):
return
- currentClass._classSetupFailed = False
+ try:
+ currentClass._classSetupFailed = False
+ except TypeError:
+ # test may actually be a function
+ # so its class will be a builtin-type
+ pass
setUpClass = getattr(currentClass, 'setUpClass', None)
if setUpClass is not None: