diff -r 3b1c44248635 Lib/lib2to3/main.py --- a/Lib/lib2to3/main.py Thu Aug 07 11:11:11 2014 -0500 +++ b/Lib/lib2to3/main.py Fri Aug 08 08:51:55 2014 -0500 @@ -2,7 +2,7 @@ Main program for 2to3. """ -from __future__ import with_statement +from __future__ import with_statement, print_function import sys import os diff -r 3b1c44248635 Lib/lib2to3/tests/__init__.py --- a/Lib/lib2to3/tests/__init__.py Thu Aug 07 11:11:11 2014 -0500 +++ b/Lib/lib2to3/tests/__init__.py Fri Aug 08 08:51:55 2014 -0500 @@ -4,21 +4,9 @@ # Author: Collin Winter import os -import os.path import unittest -import types -from . import support +from test.support import load_package_tests -all_tests = unittest.TestSuite() - -tests_dir = os.path.join(os.path.dirname(__file__), '..', 'tests') -tests = [t[0:-3] for t in os.listdir(tests_dir) - if t.startswith('test_') and t.endswith('.py')] - -loader = unittest.TestLoader() - -for t in tests: - __import__("",globals(),locals(),[t],level=1) - mod = globals()[t] - all_tests.addTests(loader.loadTestsFromModule(mod)) +def load_tests(*args): + return load_package_tests(os.path.dirname(__file__), *args) diff -r 3b1c44248635 Lib/lib2to3/tests/__main__.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Lib/lib2to3/tests/__main__.py Fri Aug 08 08:51:55 2014 -0500 @@ -0,0 +1,4 @@ +from . import load_tests +import unittest + +unittest.main() diff -r 3b1c44248635 Lib/lib2to3/tests/pytree_idempotency.py --- a/Lib/lib2to3/tests/pytree_idempotency.py Thu Aug 07 11:11:11 2014 -0500 +++ b/Lib/lib2to3/tests/pytree_idempotency.py Fri Aug 08 08:51:55 2014 -0500 @@ -4,6 +4,8 @@ """Main program for testing the infrastructure.""" +from __future__ import print_function + __author__ = "Guido van Rossum " # Support imports (need to be imported first) diff -r 3b1c44248635 Lib/lib2to3/tests/test_all_fixers.py --- a/Lib/lib2to3/tests/test_all_fixers.py Thu Aug 07 11:11:11 2014 -0500 +++ b/Lib/lib2to3/tests/test_all_fixers.py Fri Aug 08 08:51:55 2014 -0500 @@ -7,12 +7,14 @@ # Python imports import unittest +import test.support # Local imports from lib2to3 import refactor from . import support +@test.support.requires_resource('cpu') class Test_all(support.TestCase): def setUp(self): @@ -21,3 +23,6 @@ def test_all_project_files(self): for filepath in support.all_project_files(): self.refactor.refactor_file(filepath) + +if __name__ == '__main__': + unittest.main() diff -r 3b1c44248635 Lib/test/test_lib2to3.py --- a/Lib/test/test_lib2to3.py Thu Aug 07 11:11:11 2014 -0500 +++ b/Lib/test/test_lib2to3.py Fri Aug 08 08:51:55 2014 -0500 @@ -1,22 +1,5 @@ -# Skipping test_parser and test_all_fixers -# because of running -from lib2to3.tests import (test_fixers, test_pytree, test_util, test_refactor, - test_parser, - test_main as test_main_) +from lib2to3.tests import load_tests import unittest -from test.support import run_unittest - -def suite(): - tests = unittest.TestSuite() - loader = unittest.TestLoader() - for m in (test_fixers, test_pytree, test_util, test_refactor, test_parser, - test_main_): - tests.addTests(loader.loadTestsFromModule(m)) - return tests - -def test_main(): - run_unittest(suite()) - if __name__ == '__main__': - test_main() + unittest.main()