[New-bugs-announce] [issue9429] 2to3 does not rename test.test_support to test.support

Alexander Belopolsky report at bugs.python.org
Fri Jul 30 20:19:15 CEST 2010


New submission from Alexander Belopolsky <belopolsky at users.sourceforge.net>:

Even though test.support is an internal module, it is helpful to have a 2to3 fixer for the 'test_support' to 'support' rename.

My naive attempt to add a fix (see patch pasted below), worked for "from test import test_support" but not for "import test.test_support.


Index: Lib/lib2to3/fixes/fix_imports.py
===================================================================
--- Lib/lib2to3/fixes/fix_imports.py	(revision 83283)
+++ Lib/lib2to3/fixes/fix_imports.py	(working copy)
@@ -55,6 +55,7 @@
            'UserList' : 'collections',
            'urlparse' : 'urllib.parse',
            'robotparser' : 'urllib.robotparser',
+           'test.test_support' : 'test.support',
 }
 
 
Index: Lib/lib2to3/fixes/fix_renames.py
===================================================================
--- Lib/lib2to3/fixes/fix_renames.py	(revision 83283)
+++ Lib/lib2to3/fixes/fix_renames.py	(working copy)
@@ -11,6 +11,7 @@
 from ..fixer_util import Name, attr_chain
 
 MAPPING = {"sys":  {"maxint" : "maxsize"},
+           "test": {"test_support": "support"},
           }
 LOOKUP = {}

----------
components: 2to3 (2.x to 3.0 conversion tool)
messages: 112095
nosy: belopolsky
priority: normal
severity: normal
stage: needs patch
status: open
title: 2to3 does not rename test.test_support to  test.support
type: behavior
versions: Python 3.2

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue9429>
_______________________________________


More information about the New-bugs-announce mailing list