diff options
Diffstat (limited to 'Lib/test/test_email')
-rw-r--r-- | Lib/test/test_email/__init__.py | 23 | ||||
-rw-r--r-- | Lib/test/test_email/__main__.py | 5 |
2 files changed, 7 insertions, 21 deletions
diff --git a/Lib/test/test_email/__init__.py b/Lib/test/test_email/__init__.py index d8896ee..a59775c 100644 --- a/Lib/test/test_email/__init__.py +++ b/Lib/test/test_email/__init__.py @@ -1,31 +1,16 @@ import os import sys import unittest -import test.support import collections import email from email.message import Message from email._policybase import compat32 +from test.support import load_package_tests from test.test_email import __file__ as landmark -# Run all tests in package for '-m unittest test.test_email' -def load_tests(loader, standard_tests, pattern): - this_dir = os.path.dirname(__file__) - if pattern is None: - pattern = "test*" - package_tests = loader.discover(start_dir=this_dir, pattern=pattern) - standard_tests.addTests(package_tests) - return standard_tests - - -# used by regrtest and __main__. -def test_main(): - here = os.path.dirname(__file__) - # Unittest mucks with the path, so we have to save and restore - # it to keep regrtest happy. - savepath = sys.path[:] - test.support._run_suite(unittest.defaultTestLoader.discover(here)) - sys.path[:] = savepath +# Load all tests in package +def load_tests(*args): + return load_package_tests(os.path.dirname(__file__), *args) # helper code used by a number of test modules. diff --git a/Lib/test/test_email/__main__.py b/Lib/test/test_email/__main__.py index 98af9ec..4b14f77 100644 --- a/Lib/test/test_email/__main__.py +++ b/Lib/test/test_email/__main__.py @@ -1,3 +1,4 @@ -from test.test_email import test_main +from test.test_email import load_tests +import unittest -test_main() +unittest.main() |