gh-93839: Use load_package_tests() for testmock (GH-94055)

Fixes failing tests on WebAssembly platforms.

Automerge-Triggered-By: GH:tiran
This commit is contained in:
Christian Heimes 2022-06-21 14:51:39 +02:00 committed by GitHub
parent 0ff7b996f5
commit 50ebd72fb0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,17 +1,6 @@
import os
import sys
import unittest
import os.path
from test.support import load_package_tests
here = os.path.dirname(__file__)
loader = unittest.defaultTestLoader
def load_tests(*args):
suite = unittest.TestSuite()
for fn in os.listdir(here):
if fn.startswith("test") and fn.endswith(".py"):
modname = "test.test_unittest.testmock." + fn[:-3]
__import__(modname)
module = sys.modules[modname]
suite.addTest(loader.loadTestsFromModule(module))
return suite
return load_package_tests(os.path.dirname(__file__), *args)