]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-93839: Use load_package_tests() for testmock (GH-94055)
authorChristian Heimes <christian@python.org>
Tue, 21 Jun 2022 12:51:39 +0000 (14:51 +0200)
committerGitHub <noreply@github.com>
Tue, 21 Jun 2022 12:51:39 +0000 (05:51 -0700)
Fixes failing tests on WebAssembly platforms.

Automerge-Triggered-By: GH:tiran
Lib/test/test_unittest/testmock/__init__.py

index 6ee60b23765e07c3ed026eedf6b98c6a1981c1a4..bc502ef32d2916feda5f77cfa61faeb28577c058 100644 (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)