Skip to content

Commit 4b3670c

Browse files
committed
pythongh-93839: Use load_package_tests() for testmock
Fixes failing tests on WebAssembly platforms.
1 parent 94eeac0 commit 4b3670c

File tree

1 file changed

+3
-14
lines changed

1 file changed

+3
-14
lines changed
+3-14
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,6 @@
1-
import os
2-
import sys
3-
import unittest
1+
import os.path
2+
from test.support import load_package_tests
43

54

6-
here = os.path.dirname(__file__)
7-
loader = unittest.defaultTestLoader
8-
95
def load_tests(*args):
10-
suite = unittest.TestSuite()
11-
for fn in os.listdir(here):
12-
if fn.startswith("test") and fn.endswith(".py"):
13-
modname = "test.test_unittest.testmock." + fn[:-3]
14-
__import__(modname)
15-
module = sys.modules[modname]
16-
suite.addTest(loader.loadTestsFromModule(module))
17-
return suite
6+
return load_package_tests(os.path.dirname(__file__), *args)

0 commit comments

Comments
 (0)