diff --git a/Lib/lib2to3/tests/__init__.py b/Lib/lib2to3/tests/__init__.py deleted file mode 100644 --- a/Lib/lib2to3/tests/__init__.py +++ /dev/null @@ -1,24 +0,0 @@ -"""Make tests/ into a package. This allows us to "import tests" and -have tests.all_tests be a TestSuite representing all test cases -from all test_*.py files in tests/.""" -# Author: Collin Winter - -import os -import os.path -import unittest -import types - -from . import support - -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)) diff --git a/Lib/test/test_lib2to3.py b/Lib/test/test_lib2to3/__init__.py rename from Lib/test/test_lib2to3.py rename to Lib/test/test_lib2to3/__init__.py --- a/Lib/test/test_lib2to3.py +++ b/Lib/test/test_lib2to3/__init__.py @@ -1,8 +1,8 @@ # 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 test.test_lib2to3 import (test_fixers, test_pytree, test_util, test_refactor, + test_parser, + test_main as test_main_) import unittest from test.support import run_unittest diff --git a/Lib/lib2to3/tests/data/README b/Lib/test/test_lib2to3/data/README rename from Lib/lib2to3/tests/data/README rename to Lib/test/test_lib2to3/data/README diff --git a/Lib/lib2to3/tests/data/bom.py b/Lib/test/test_lib2to3/data/bom.py rename from Lib/lib2to3/tests/data/bom.py rename to Lib/test/test_lib2to3/data/bom.py diff --git a/Lib/lib2to3/tests/data/crlf.py b/Lib/test/test_lib2to3/data/crlf.py rename from Lib/lib2to3/tests/data/crlf.py rename to Lib/test/test_lib2to3/data/crlf.py diff --git a/Lib/lib2to3/tests/data/different_encoding.py b/Lib/test/test_lib2to3/data/different_encoding.py rename from Lib/lib2to3/tests/data/different_encoding.py rename to Lib/test/test_lib2to3/data/different_encoding.py diff --git a/Lib/lib2to3/tests/data/fixers/bad_order.py b/Lib/test/test_lib2to3/data/fixers/bad_order.py rename from Lib/lib2to3/tests/data/fixers/bad_order.py rename to Lib/test/test_lib2to3/data/fixers/bad_order.py diff --git a/Lib/lib2to3/tests/data/fixers/myfixes/__init__.py b/Lib/test/test_lib2to3/data/fixers/myfixes/__init__.py rename from Lib/lib2to3/tests/data/fixers/myfixes/__init__.py rename to Lib/test/test_lib2to3/data/fixers/myfixes/__init__.py diff --git a/Lib/lib2to3/tests/data/fixers/myfixes/fix_explicit.py b/Lib/test/test_lib2to3/data/fixers/myfixes/fix_explicit.py rename from Lib/lib2to3/tests/data/fixers/myfixes/fix_explicit.py rename to Lib/test/test_lib2to3/data/fixers/myfixes/fix_explicit.py diff --git a/Lib/lib2to3/tests/data/fixers/myfixes/fix_first.py b/Lib/test/test_lib2to3/data/fixers/myfixes/fix_first.py rename from Lib/lib2to3/tests/data/fixers/myfixes/fix_first.py rename to Lib/test/test_lib2to3/data/fixers/myfixes/fix_first.py diff --git a/Lib/lib2to3/tests/data/fixers/myfixes/fix_last.py b/Lib/test/test_lib2to3/data/fixers/myfixes/fix_last.py rename from Lib/lib2to3/tests/data/fixers/myfixes/fix_last.py rename to Lib/test/test_lib2to3/data/fixers/myfixes/fix_last.py diff --git a/Lib/lib2to3/tests/data/fixers/myfixes/fix_parrot.py b/Lib/test/test_lib2to3/data/fixers/myfixes/fix_parrot.py rename from Lib/lib2to3/tests/data/fixers/myfixes/fix_parrot.py rename to Lib/test/test_lib2to3/data/fixers/myfixes/fix_parrot.py diff --git a/Lib/lib2to3/tests/data/fixers/myfixes/fix_preorder.py b/Lib/test/test_lib2to3/data/fixers/myfixes/fix_preorder.py rename from Lib/lib2to3/tests/data/fixers/myfixes/fix_preorder.py rename to Lib/test/test_lib2to3/data/fixers/myfixes/fix_preorder.py diff --git a/Lib/lib2to3/tests/data/fixers/no_fixer_cls.py b/Lib/test/test_lib2to3/data/fixers/no_fixer_cls.py rename from Lib/lib2to3/tests/data/fixers/no_fixer_cls.py rename to Lib/test/test_lib2to3/data/fixers/no_fixer_cls.py diff --git a/Lib/lib2to3/tests/data/fixers/parrot_example.py b/Lib/test/test_lib2to3/data/fixers/parrot_example.py rename from Lib/lib2to3/tests/data/fixers/parrot_example.py rename to Lib/test/test_lib2to3/data/fixers/parrot_example.py diff --git a/Lib/lib2to3/tests/data/infinite_recursion.py b/Lib/test/test_lib2to3/data/infinite_recursion.py rename from Lib/lib2to3/tests/data/infinite_recursion.py rename to Lib/test/test_lib2to3/data/infinite_recursion.py diff --git a/Lib/lib2to3/tests/data/py2_test_grammar.py b/Lib/test/test_lib2to3/data/py2_test_grammar.py rename from Lib/lib2to3/tests/data/py2_test_grammar.py rename to Lib/test/test_lib2to3/data/py2_test_grammar.py diff --git a/Lib/lib2to3/tests/data/py3_test_grammar.py b/Lib/test/test_lib2to3/data/py3_test_grammar.py rename from Lib/lib2to3/tests/data/py3_test_grammar.py rename to Lib/test/test_lib2to3/data/py3_test_grammar.py diff --git a/Lib/lib2to3/tests/pytree_idempotency.py b/Lib/test/test_lib2to3/pytree_idempotency.py rename from Lib/lib2to3/tests/pytree_idempotency.py rename to Lib/test/test_lib2to3/pytree_idempotency.py diff --git a/Lib/lib2to3/tests/support.py b/Lib/test/test_lib2to3/support.py rename from Lib/lib2to3/tests/support.py rename to Lib/test/test_lib2to3/support.py --- a/Lib/lib2to3/tests/support.py +++ b/Lib/test/test_lib2to3/support.py @@ -15,7 +15,7 @@ test_dir = os.path.dirname(__file__) proj_dir = os.path.normpath(os.path.join(test_dir, "..")) -grammar_path = os.path.join(test_dir, "..", "Grammar.txt") +grammar_path = os.path.join(test_dir, "..", "..", "lib2to3", "Grammar.txt") grammar = driver.load_grammar(grammar_path) driver = driver.Driver(grammar, convert=pytree.convert) diff --git a/Lib/lib2to3/tests/test_all_fixers.py b/Lib/test/test_lib2to3/test_all_fixers.py rename from Lib/lib2to3/tests/test_all_fixers.py rename to Lib/test/test_lib2to3/test_all_fixers.py diff --git a/Lib/lib2to3/tests/test_fixers.py b/Lib/test/test_lib2to3/test_fixers.py rename from Lib/lib2to3/tests/test_fixers.py rename to Lib/test/test_lib2to3/test_fixers.py --- a/Lib/lib2to3/tests/test_fixers.py +++ b/Lib/test/test_lib2to3/test_fixers.py @@ -8,7 +8,7 @@ # Local imports from lib2to3 import pygram, pytree, refactor, fixer_util -from lib2to3.tests import support +from test.test_lib2to3 import support class FixerTestCase(support.TestCase): @@ -1788,7 +1788,7 @@ class Test_imports(FixerTestCase, ImportsFixerTests): fixer = "imports" - from ..fixes.fix_imports import MAPPING as modules + from lib2to3.fixes.fix_imports import MAPPING as modules def test_multiple_imports(self): b = """import urlparse, cStringIO""" @@ -1809,16 +1809,16 @@ class Test_imports2(FixerTestCase, ImportsFixerTests): fixer = "imports2" - from ..fixes.fix_imports2 import MAPPING as modules + from lib2to3.fixes.fix_imports2 import MAPPING as modules class Test_imports_fixer_order(FixerTestCase, ImportsFixerTests): def setUp(self): super(Test_imports_fixer_order, self).setUp(['imports', 'imports2']) - from ..fixes.fix_imports2 import MAPPING as mapping2 + from lib2to3.fixes.fix_imports2 import MAPPING as mapping2 self.modules = mapping2.copy() - from ..fixes.fix_imports import MAPPING as mapping1 + from lib2to3.fixes.fix_imports import MAPPING as mapping1 for key in ('dbhash', 'dumbdbm', 'dbm', 'gdbm'): self.modules[key] = mapping1[key] @@ -1830,7 +1830,7 @@ class Test_urllib(FixerTestCase): fixer = "urllib" - from ..fixes.fix_urllib import MAPPING as modules + from lib2to3.fixes.fix_urllib import MAPPING as modules def test_import_module(self): for old, changes in self.modules.items(): diff --git a/Lib/lib2to3/tests/test_main.py b/Lib/test/test_lib2to3/test_main.py rename from Lib/lib2to3/tests/test_main.py rename to Lib/test/test_lib2to3/test_main.py diff --git a/Lib/lib2to3/tests/test_parser.py b/Lib/test/test_lib2to3/test_parser.py rename from Lib/lib2to3/tests/test_parser.py rename to Lib/test/test_lib2to3/test_parser.py --- a/Lib/lib2to3/tests/test_parser.py +++ b/Lib/test/test_lib2to3/test_parser.py @@ -22,7 +22,7 @@ # Local imports from lib2to3.pgen2 import tokenize -from ..pgen2.parse import ParseError +from lib2to3.pgen2.parse import ParseError from lib2to3.pygram import python_symbols as syms diff --git a/Lib/lib2to3/tests/test_pytree.py b/Lib/test/test_lib2to3/test_pytree.py rename from Lib/lib2to3/tests/test_pytree.py rename to Lib/test/test_lib2to3/test_pytree.py diff --git a/Lib/lib2to3/tests/test_refactor.py b/Lib/test/test_lib2to3/test_refactor.py rename from Lib/lib2to3/tests/test_refactor.py rename to Lib/test/test_lib2to3/test_refactor.py diff --git a/Lib/lib2to3/tests/test_util.py b/Lib/test/test_lib2to3/test_util.py rename from Lib/lib2to3/tests/test_util.py rename to Lib/test/test_lib2to3/test_util.py