Commits

Joe Amenta committed 82b2414

Bumping up the Python 3 version to 3.2,
Applying the change from changeset 282:3d4fe20d5360 to the alternate-format version,
Making test_all_fixers exit with a non-zero exit code when a test fails, and
Removing the now-useless "test-local" target from Makefile.

Comments (0)

Files changed (7)

-#!/usr/bin/env python3.1
+#!/usr/bin/env python3.2
 import sys
 
 from lib3to2.main import main
-PYVERSION = python3.1
+PYVERSION = python3.2
 SETUP = ./setup.py
 FIND = find
 
-.PHONY: dist install test install-local test-local uninstall-local clean dangerously-clean
+.PHONY: dist install test install-local uninstall-local clean dangerously-clean
 
 dist:
 	$(SETUP) build sdist
 	rm -rf $(HOME)/.local/lib/$(PYVERSION)/site-packages/3to2-*.egg-info
 	rm -rf $(HOME)/.local/bin/3to2
 
-test-local: uninstall-local install-local
-	$(PYVERSION) $(HOME)/.local/lib/$(PYVERSION)/site-packages/lib3to2/tests/test_all_fixers.py
-
 install:
 	$(SETUP) install
 
 test:
-	lib3to2/tests/test_all_fixers.py
+	$(PYVERSION) test_all_fixers.py
 
 clean:
 	rm -rf build dist MANIFEST
 
 python2: clean
 	cp -r lib3to2 lib3to2_replace
-	python3.1 ./3to2 --no-diffs -n -j 10 -w lib3to2_replace
+	$(PYVERSION) ./3to2 --no-diffs -n -j 10 -w lib3to2_replace
 	rm -rf lib3to2
 	mv lib3to2_replace lib3to2
 	patch -p0 < python2.patch

lib3to2/fixes/imports_fix_alt_formatting.py

            "http.client": "httplib",
            "http.cookies": "Cookie",
            "http.cookiejar": "cookielib",
-#          "tkinter": "Tkinter",
+           "tkinter": "Tkinter",
            "tkinter.dialog": "Dialog",
            "tkinter._fix": "FixTk",
            "tkinter.scrolledtext": "ScrolledText",
 
 class FixImports(fixer_base.BaseFix):
 
+    order = "pre"
+
     PATTERN = ' | \n'.join([all_patterns(name) for name in MAPPING])
     PATTERN = ' | \n'.join((PATTERN, multiple_name_import_match))
 

lib3to2/tests/support.py

     # From lib2to3.tests.support (copied without changes).
     if tests is None:
         tests = unittest.TestLoader().loadTestsFromModule(test_mod)
-    unittest.TextTestRunner(verbosity=2).run(tests)
+    return unittest.TextTestRunner(verbosity=2).run(tests)
 
 
 def reformat(string):
 --- setup.py	2010-05-24 19:46:36.000000000 -0400
 +++ setup.py	2010-05-25 14:51:00.000000000 -0400
 @@ -1,4 +1,4 @@
--#!/usr/bin/env python3.1
+-#!/usr/bin/env python3.2
 +#!/usr/bin/env python2.7
  
  classifiers = [
  "License :: OSI Approved :: Apache Software License",
  "Operating System :: OS Independent",
 -"Programming Language :: Python :: 3",
--"Programming Language :: Python :: 3.1",
+-"Programming Language :: Python :: 3.2",
 +"Programming Language :: Python :: 2.7",
  "Topic :: Software Development :: Code Generators",
  "Topic :: Software Development :: Libraries :: Python Modules",
 --- 3to2	2010-05-24 19:45:12.000000000 -0400
 +++ 3to2	2010-05-24 19:49:01.000000000 -0400
 @@ -1,6 +1,12 @@
--#!/usr/bin/env python3.1
+-#!/usr/bin/env python3.2
 +#!/usr/bin/env python2.7
  import sys
  
 --- Makefile	2010-05-25 15:27:04.000000000 -0400
 +++ Makefile	2010-05-25 15:32:09.000000000 -0400
 @@ -1,4 +1,4 @@
--PYVERSION = python3.1
+-PYVERSION = python3.2
 +PYVERSION = python2.7
  SETUP = ./setup.py
  FIND = find
  
 
---- lib3to2/tests/test_all_fixers.py	2010-05-24 19:45:12.000000000 -0400
-+++ lib3to2/tests/test_all_fixers.py	2010-05-25 15:34:10.000000000 -0400
+--- test_all_fixers.py	2010-05-24 19:45:12.000000000 -0400
++++ test_all_fixers.py	2010-05-25 15:34:10.000000000 -0400
 @@ -1,4 +1,4 @@
--#!/usr/bin/env python3.1
+-#!/usr/bin/env python3.2
 +#!/usr/bin/env python2.7
- u"""
+ """
  Runs all tests in the same directory named test_*.py
  """
-#!/usr/bin/env python3.1
+#!/usr/bin/env python3.2
 
 classifiers = [
 "Development Status :: 5 - Production/Stable",
 "License :: OSI Approved :: Apache Software License",
 "Operating System :: OS Independent",
 "Programming Language :: Python :: 3",
-"Programming Language :: Python :: 3.1",
+"Programming Language :: Python :: 3.2",
 "Topic :: Software Development :: Code Generators",
 "Topic :: Software Development :: Libraries :: Python Modules",
 ]
    version="1.0",
    url="http://www.startcodon.com/wordpress/?cat=8",
    author="Joe Amenta",
-   author_email="amentajo@msu.edu",
+   author_email="airbreather@linux.com",
    classifiers=classifiers,
    description="Refactors valid 3.x syntax into valid 2.x syntax, if a syntactical conversion is possible",
    long_description="",

test_all_fixers.py

-#!/usr/bin/env python3.1
+#!/usr/bin/env python3.2
 """
 Runs all test cases in tests directory named test_*.py
 """
 tests_package = 'lib3to2.tests'
 
 if __name__ == "__main__":
+    from sys import exit
+    passed = True
     for module in os.listdir(tests_package.replace('.', os.sep)):
         if module.endswith('.py') and module.startswith('test_'):
             module = tests_package + '.' + module[:-3]
             _module = importlib.import_module(module)
-            support.run_all_tests(_module)
+            result = support.run_all_tests(_module)
+            passed = passed and not result.failures
+    if not passed:
+       exit(1)