[Python-checkins] CVS: python/dist/src/Lib/test badsyntax_future3.py,NONE,1.1 badsyntax_future4.py,NONE,1.1 badsyntax_future5.py,NONE,1.1 badsyntax_future6.py,NONE,1.1 badsyntax_future7.py,NONE,1.1 badsyntax_nocaret.py,NONE,1.1 regrtest.py,1.32,1.33 test_future.py,1.2,1.3 test_traceback.py,1.2,1.3 nocaret.py,1.1,NONE test_future3.py,1.1,NONE test_future4.py,1.1,NONE test_future5.py,1.1,NONE test_future6.py,1.1,NONE test_future7.py,1.1,NONE
Jeremy Hylton
jhylton@users.sourceforge.net
Tue, 17 Apr 2001 18:19:30 -0700
Update of /cvsroot/python/python/dist/src/Lib/test
In directory usw-pr-cvs1:/tmp/cvs-serv23878
Modified Files:
regrtest.py test_future.py test_traceback.py
Added Files:
badsyntax_future3.py badsyntax_future4.py badsyntax_future5.py
badsyntax_future6.py badsyntax_future7.py badsyntax_nocaret.py
Removed Files:
nocaret.py test_future3.py test_future4.py test_future5.py
test_future6.py test_future7.py
Log Message:
Fix compileall.py so that it fails on SyntaxErrors
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.
--- NEW FILE: badsyntax_future3.py ---
"""This is a test"""
from __future__ import nested_scopes
from __future__ import rested_snopes
def f(x):
def g(y):
return x + y
return g
print f(2)(4)
--- NEW FILE: badsyntax_future4.py ---
"""This is a test"""
import __future__
from __future__ import nested_scopes
def f(x):
def g(y):
return x + y
return g
print f(2)(4)
--- NEW FILE: badsyntax_future5.py ---
"""This is a test"""
from __future__ import nested_scopes
import foo
from __future__ import nested_scopes
def f(x):
def g(y):
return x + y
return g
print f(2)(4)
--- NEW FILE: badsyntax_future6.py ---
"""This is a test"""
"this isn't a doc string"
from __future__ import nested_scopes
def f(x):
def g(y):
return x + y
return g
print f(2)(4)
--- NEW FILE: badsyntax_future7.py ---
"""This is a test"""
from __future__ import nested_scopes; import string; from __future__ import \
nested_scopes
def f(x):
def g(y):
return x + y
return g
print f(2)(4)
--- NEW FILE: badsyntax_nocaret.py ---
def f(x):
[x for x in x] = x
Index: regrtest.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/regrtest.py,v
retrieving revision 1.32
retrieving revision 1.33
diff -C2 -r1.32 -r1.33
*** regrtest.py 2001/02/28 17:48:06 1.32
--- regrtest.py 2001/04/18 01:19:27 1.33
***************
*** 200,208 ****
'test_future1',
'test_future2',
- 'test_future3',
- 'test_future4',
- 'test_future5',
- 'test_future6',
- 'test_future7',
]
--- 200,203 ----
Index: test_future.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_future.py,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** test_future.py 2001/03/01 08:31:39 1.2
--- test_future.py 2001/04/18 01:19:27 1.3
***************
*** 20,44 ****
# The remaining tests should fail
try:
! import test_future3
except SyntaxError, msg:
check_error_location(str(msg))
try:
! import test_future4
except SyntaxError, msg:
check_error_location(str(msg))
try:
! import test_future5
except SyntaxError, msg:
check_error_location(str(msg))
try:
! import test_future6
except SyntaxError, msg:
check_error_location(str(msg))
try:
! import test_future7
except SyntaxError, msg:
check_error_location(str(msg))
--- 20,44 ----
# The remaining tests should fail
try:
! import badsyntax_future3
except SyntaxError, msg:
check_error_location(str(msg))
try:
! import badsyntax_future4
except SyntaxError, msg:
check_error_location(str(msg))
try:
! import badsyntax_future5
except SyntaxError, msg:
check_error_location(str(msg))
try:
! import badsyntax_future6
except SyntaxError, msg:
check_error_location(str(msg))
try:
! import badsyntax_future7
except SyntaxError, msg:
check_error_location(str(msg))
Index: test_traceback.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_traceback.py,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** test_traceback.py 2001/04/08 07:44:07 1.2
--- test_traceback.py 2001/04/18 01:19:27 1.3
***************
*** 23,27 ****
def syntax_error_without_caret(self):
# XXX why doesn't compile raise the same traceback?
! import nocaret
def test_caret(self):
--- 23,27 ----
def syntax_error_without_caret(self):
# XXX why doesn't compile raise the same traceback?
! import badsyntax_nocaret
def test_caret(self):
--- nocaret.py DELETED ---
--- test_future3.py DELETED ---
--- test_future4.py DELETED ---
--- test_future5.py DELETED ---
--- test_future6.py DELETED ---
--- test_future7.py DELETED ---