Author: Antonio Cuni <[email protected]>
Branch: py3k
Changeset: r51836:003f9177cdb4
Date: 2012-01-27 00:06 +0100
http://bitbucket.org/pypy/pypy/changeset/003f9177cdb4/
Log: don't try to run python3 if we cannot find it
diff --git a/pypy/interpreter/test/test_syntax.py
b/pypy/interpreter/test/test_syntax.py
--- a/pypy/interpreter/test/test_syntax.py
+++ b/pypy/interpreter/test/test_syntax.py
@@ -138,7 +138,13 @@
checkinvalid(space, %r)
""" % (i, i, INVALID[i], INVALID[i])
+
+PYTHON3 = py.path.local.sysfind('python3')
def checksyntax_cpython(tmpdir, i, s):
+ if PYTHON3 is None:
+ print 'Warning: cannot run python3 to check syntax'
+ return
+
src = '''
try:
exec("""%s
@@ -151,12 +157,12 @@
''' % s
pyfile = tmpdir.join('checkvalid_%d.py' % i)
pyfile.write(src)
- res = commands.getoutput('python3 "%s"' % pyfile)
+ res = commands.getoutput('"%s" "%s"' % (PYTHON3, pyfile))
return res
def checkvalid_cpython(tmpdir, i, s):
res = checksyntax_cpython(tmpdir, i, s)
- if res != 'OK':
+ if res is not None and res != 'OK':
print s
print
print res
@@ -164,7 +170,7 @@
def checkinvalid_cpython(tmpdir, i, s):
res = checksyntax_cpython(tmpdir, i, s)
- if res == 'OK':
+ if res is not None and res == 'OK':
print s
print
print res
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit