PyPy compatibility tests! (tested with v5.3.1 - Python 2.7 compatible - working)
This commit is contained in:
parent
8ea931cf8f
commit
3d02248afe
|
@ -157,7 +157,7 @@ class PolyFinder(object):
|
||||||
|
|
||||||
def _polyloader_pathhook(path):
|
def _polyloader_pathhook(path):
|
||||||
if not os.path.isdir(path):
|
if not os.path.isdir(path):
|
||||||
raise ImportError('Only directories are supported', path=path)
|
raise ImportError('Only directories are supported: %s' % path)
|
||||||
return PolyFinder(path)
|
return PolyFinder(path)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -71,13 +71,8 @@ class Test_Imports(object):
|
||||||
print >> f, "a =", a
|
print >> f, "a =", a
|
||||||
print >> f, "b =", b
|
print >> f, "b =", b
|
||||||
|
|
||||||
if os.path.exists(source):
|
|
||||||
print "%s EXISTS..." % source
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
print "IMPORT..."
|
|
||||||
mod = __import__(TESTFN)
|
mod = __import__(TESTFN)
|
||||||
print "END IMPORT..."
|
|
||||||
except ImportError, err:
|
except ImportError, err:
|
||||||
print("import from %s (%s) failed: %s" % (ext, os.curdir, err))
|
print("import from %s (%s) failed: %s" % (ext, os.curdir, err))
|
||||||
assert(False)
|
assert(False)
|
||||||
|
@ -91,7 +86,8 @@ class Test_Imports(object):
|
||||||
if not sys.dont_write_bytecode:
|
if not sys.dont_write_bytecode:
|
||||||
imp.reload(mod)
|
imp.reload(mod)
|
||||||
except ImportError, err:
|
except ImportError, err:
|
||||||
self.fail("import from .pyc/.pyo failed: %s" % err)
|
print("import from .pyc/.pyo failed: %s" % err)
|
||||||
|
assert(False)
|
||||||
finally:
|
finally:
|
||||||
clean_tmpfiles(source)
|
clean_tmpfiles(source)
|
||||||
unload(TESTFN)
|
unload(TESTFN)
|
||||||
|
|
|
@ -38,6 +38,17 @@ def unload(name):
|
||||||
except KeyError:
|
except KeyError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
def rmtree(path):
|
||||||
|
def _rmtree_inner(path):
|
||||||
|
for name in os.listdir(path):
|
||||||
|
fullname = os.path.join(path, name)
|
||||||
|
if os.path.isdir(fullname):
|
||||||
|
_waitfor(_rmtree_inner, fullname, waitall=True)
|
||||||
|
os.rmdir(fullname)
|
||||||
|
else:
|
||||||
|
os.unlink(fullname)
|
||||||
|
_rmtree_inner(path)
|
||||||
|
os.rmdir(path)
|
||||||
|
|
||||||
class Test_Paths:
|
class Test_Paths:
|
||||||
path = TESTFN
|
path = TESTFN
|
||||||
|
@ -53,9 +64,9 @@ class Test_Paths:
|
||||||
# Regression test for http://bugs.python.org/issue1293.
|
# Regression test for http://bugs.python.org/issue1293.
|
||||||
def test_trailing_slash(self):
|
def test_trailing_slash(self):
|
||||||
with open(os.path.join(self.path, 'test_trailing_slash.2'), 'w') as f:
|
with open(os.path.join(self.path, 'test_trailing_slash.2'), 'w') as f:
|
||||||
f.write("testdata = 'test_trailing_slash'")
|
f.write("Test Trailing Slash\n")
|
||||||
sys.path.append(self.path+'/')
|
sys.path.append(self.path+'/')
|
||||||
mod = __import__("test_trailing_slash")
|
mod = __import__("test_trailing_slash")
|
||||||
self.assertEqual(mod.testdata, 'test_trailing_slash')
|
assert(mod.result == 'Success for 2: Test Trailing Slash')
|
||||||
unload("test_trailing_slash")
|
unload("test_trailing_slash")
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue