Utkarsh Upadhyay added the comment: So the problem is occurring because a single `Test` class is being instantiated with three different tests here in datetimetester.py:
for name in ZoneInfo.zonenames(): Test = type('ZoneInfoTest[%s]' % name, (ZoneInfoTest,), {}) Test.zonename = name for method in dir(Test): if method.startswith('test_'): tests.append(Test(method)) here: https://github.com/python/cpython/blob/master/Lib/test/datetimetester.py#L4853 The `Test` class which is being dynamically created is being instantiated with the test methods: test_folds, test_gaps, test_system_transitions and is being appended to tests. This makes that class to appear thrice in `test_classes` in `test_datetime.py`: elif issubclass(cls, unittest.TestSuite): suit = cls() test_classes.extend(type(test) for test in suit) here: https://github.com/python/cpython/blob/master/Lib/test/test_datetime.py#L34 Hence, the class gets `_Pure` and `_Fast` appended to its name thrice and gets executed thrice, making the tests take 3 times as long to run. This is confirmed by changing the code to the following: for name in ZoneInfo.zonenames(): Test = type('ZoneInfoTest[%s]' % name, (ZoneInfoTest,), {}) Test.zonename = name tests.append(Test()) # for method in dir(Test): # if method.startswith('test_'): # tests.append(Test(method)) However, I'm not sure what implications this has w.r.t. unittests and the advanced cases. The other way to fix it is to create a set out of the classes, as suggested in PR #2534. ~ ut ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue30822> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com