make all syntax compatible with 3.1 and 2.5

--HG--
branch : trunk
This commit is contained in:
Benjamin Peterson
2009-08-29 13:04:48 -05:00
parent 6f4c6d36a4
commit ee1747fcb4
60 changed files with 230 additions and 177 deletions

View File

@@ -85,7 +85,7 @@ def test_importall():
yield check_import, modpath
def check_import(modpath):
print "checking import", modpath
py.builtin.print_("checking import", modpath)
assert __import__(modpath)
#

View File

@@ -25,7 +25,7 @@ def test_invoke_compile(recwarn, monkeypatch):
return 1
\n""", '', 'exec')
d = {}
exec co in d
py.builtin.exec_(co, d)
assert py.code.Source(d['f'])
finally:
py.magic.revoke(compile=True)
@@ -100,12 +100,12 @@ class Testautopath:
d = {'__file__' : str(testpath)}
oldsyspath = sys.path[:]
try:
exec self.getauto in d
py.test.exec_(self.getauto, d)
conf = d['autopath']
assert conf.dirpath() == self.initdir2
assert conf.pkgdir == self.initdir
assert str(self.root) in sys.path
exec self.getauto in d
py.test.exec_(self.getauto in d)
assert conf is not d['autopath']
finally:
sys.path[:] = oldsyspath
@@ -116,12 +116,12 @@ class Testautopath:
d = {'__file__' : str(testpath)}
oldsyspath = sys.path[:]
try:
exec self.getauto in d
py.test.exec_(self.getauto, d)
conf = d['autopath']
assert conf == self.initdir2.join('autoconfiguretest.py')
assert conf.pkgdir == self.initdir
assert str(self.root) in sys.path
exec self.getauto in d
py.test.exec_(self.getauto, d)
assert conf is not d['autopath']
finally:
sys.path[:] = oldsyspath
@@ -131,13 +131,13 @@ class Testautopath:
d = {'__file__' : str(testpath)}
oldsyspath = sys.path[:]
try:
exec self.getauto in d
py.test.exec_(self.getauto, d)
conf = d['autopath']
assert conf.dirpath() == self.root
assert conf.pkgdir == self.root
syspath = sys.path[:]
assert str(self.root) in syspath
exec self.getauto in d
py.test.exec_(self.getauto, d)
assert conf is not d['autopath']
finally:
sys.path[:] = oldsyspath
@@ -149,7 +149,7 @@ class Testautopath:
oldsyspath = sys.path[:]
try:
d = {}
exec self.getauto in d
py.test.exec_(self.getauto, d)
conf = d['autopath']
assert conf.dirpath() == self.initdir2
assert conf.pkgdir == self.initdir
@@ -167,7 +167,7 @@ class Testautopath:
try:
py.test.raises(ValueError,'''
d = {}
exec self.getauto in d
py.test.exec_(self.getauto, d)
''')
finally:
sys.path[:] = oldsyspath