diff --git a/Lib/lib2to3/fixes/fix_imports.py b/Lib/lib2to3/fixes/fix_imports.py index 03a27bc38ec..a7a4086d526 100644 --- a/Lib/lib2to3/fixes/fix_imports.py +++ b/Lib/lib2to3/fixes/fix_imports.py @@ -19,6 +19,11 @@ # XXX: overhead to the fixer. MAPPING = {"StringIO": ("io", ["StringIO"]), "cStringIO": ("io", ["StringIO"]), + "cPickle": ("pickle", ['BadPickleGet', 'HIGHEST_PROTOCOL', + 'PickleError', 'Pickler', 'PicklingError', + 'UnpickleableError', 'Unpickler', 'UnpicklingError', + 'compatible_formats', 'dump', 'dumps', 'format_version', + 'load', 'loads']), "__builtin__" : ("builtins", builtin_names), 'copy_reg': ('copyreg', ['pickle', 'constructor', diff --git a/Lib/lib2to3/tests/test_fixers.py b/Lib/lib2to3/tests/test_fixers.py index d1d25095f6b..9079341776f 100755 --- a/Lib/lib2to3/tests/test_fixers.py +++ b/Lib/lib2to3/tests/test_fixers.py @@ -1405,10 +1405,7 @@ def test_unchanged(self): s = "foo(xreadlines)" self.unchanged(s) -# Disable test, as it takes a too long time to run, and also -# fails in 2.6. -#class Test_imports(FixerTestCase): -class Test_imports: +class Test_imports(FixerTestCase): fixer = "imports" from ..fixes.fix_imports import MAPPING as modules diff --git a/Lib/test/test_lib2to3.py b/Lib/test/test_lib2to3.py index 9bd4496726a..3af6afa6d46 100644 --- a/Lib/test/test_lib2to3.py +++ b/Lib/test/test_lib2to3.py @@ -2,7 +2,11 @@ # because of running from lib2to3.tests import test_fixers, test_pytree, test_util import unittest -from test.support import run_unittest +from test.support import run_unittest, requires + +# Don't run lib2to3 tests by default since they take too long +if __name__ != '__main__': + requires('lib2to3') def suite(): tests = unittest.TestSuite()