]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Fix compileall.py so that it fails on SyntaxErrors
authorJeremy Hylton <jeremy@alum.mit.edu>
Wed, 18 Apr 2001 01:19:28 +0000 (01:19 +0000)
committerJeremy Hylton <jeremy@alum.mit.edu>
Wed, 18 Apr 2001 01:19:28 +0000 (01:19 +0000)
The changes cause compilation failures in any file in the Python
installation lib directory to cause the install to fail.  It looks
like compileall.py intended to behave this way, but a change to
py_compile.py and a separate bug defeated it.

Fixes SF bug #412436

This change affects the test suite, which contains several files that
contain intentional errors.  The solution is to extend compileall.py
with the ability to skip compilation of selected files.

In the test suite, rename nocaret.py and test_future[3..7].py to start
with badsyntax_nocaret.py and badsyntax_future[3..7].py.  Update the
makefile to skip compilation of these files.  Update the tests to use
the name names for imports.

NB compileall.py is changed so that compile_dir() returns success only
if all recursive calls to compile_dir() also check success.

Lib/test/badsyntax_future3.py [moved from Lib/test/test_future3.py with 100% similarity]
Lib/test/badsyntax_future4.py [moved from Lib/test/test_future4.py with 100% similarity]
Lib/test/badsyntax_future5.py [moved from Lib/test/test_future5.py with 100% similarity]
Lib/test/badsyntax_future6.py [moved from Lib/test/test_future6.py with 100% similarity]
Lib/test/badsyntax_future7.py [moved from Lib/test/test_future7.py with 100% similarity]
Lib/test/badsyntax_nocaret.py [moved from Lib/test/nocaret.py with 100% similarity]
Lib/test/output/test_future
Lib/test/regrtest.py
Lib/test/test_future.py
Lib/test/test_traceback.py

index 5d7770af1f9405fd967c95fa7e0e2cd7a5fd4305..4631489a8827d33343ad6b84774028af52d0e798 100644 (file)
@@ -1,8 +1,8 @@
 test_future
 6
 6
-SyntaxError test_future3 3
-SyntaxError test_future4 3
-SyntaxError test_future5 4
-SyntaxError test_future6 3
-SyntaxError test_future7 3
+SyntaxError badsyntax_future3 3
+SyntaxError badsyntax_future4 3
+SyntaxError badsyntax_future5 4
+SyntaxError badsyntax_future6 3
+SyntaxError badsyntax_future7 3
index f05f7645c4864ed04e4b8076cd6f51665772d56b..ffa67f1b41fd65bd21392c66b15d3b8957f795d6 100755 (executable)
@@ -199,11 +199,6 @@ NOTTESTS = [
     'test_b2',
     'test_future1',
     'test_future2',
-    'test_future3',
-    'test_future4',
-    'test_future5',
-    'test_future6',
-    'test_future7',
     ]
 
 def findtests(testdir=None, stdtests=STDTESTS, nottests=NOTTESTS):
index 1ffda5e36f88183511356ca74d347af81ee588c7..ba0763b7c7106addde83b525c81a1beb741127b8 100644 (file)
@@ -19,26 +19,26 @@ import test_future2
 
 # The remaining tests should fail
 try:
-    import test_future3
+    import badsyntax_future3
 except SyntaxError, msg:
     check_error_location(str(msg))
 
 try:
-    import test_future4
+    import badsyntax_future4
 except SyntaxError, msg:
     check_error_location(str(msg))
 
 try:
-    import test_future5
+    import badsyntax_future5
 except SyntaxError, msg:
     check_error_location(str(msg))
 
 try:
-    import test_future6
+    import badsyntax_future6
 except SyntaxError, msg:
     check_error_location(str(msg))
 
 try:
-    import test_future7
+    import badsyntax_future7
 except SyntaxError, msg:
     check_error_location(str(msg))
index 759cc98c177c40e1fe9b2a83183aed529ec3796f..9f818e1607879742376457e4ae3b31cb476c2f02 100644 (file)
@@ -22,7 +22,7 @@ class TracebackCases(unittest.TestCase):
 
     def syntax_error_without_caret(self):
         # XXX why doesn't compile raise the same traceback?
-        import nocaret
+        import badsyntax_nocaret
 
     def test_caret(self):
         err = self.get_exception_format(self.syntax_error_with_caret,