PyPy compatibility tests! (tested with v5.3.1 - Python 2.7 compatible - working)

This commit is contained in:
Elf M. Sternberg 2016-06-30 23:04:22 -07:00
parent 8ea931cf8f
commit 3d02248afe
4 changed files with 17 additions and 10 deletions

View File

@ -157,7 +157,7 @@ class PolyFinder(object):
def _polyloader_pathhook(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)

View File

@ -71,13 +71,8 @@ class Test_Imports(object):
print >> f, "a =", a
print >> f, "b =", b
if os.path.exists(source):
print "%s EXISTS..." % source
try:
print "IMPORT..."
mod = __import__(TESTFN)
print "END IMPORT..."
except ImportError, err:
print("import from %s (%s) failed: %s" % (ext, os.curdir, err))
assert(False)
@ -91,7 +86,8 @@ class Test_Imports(object):
if not sys.dont_write_bytecode:
imp.reload(mod)
except ImportError, err:
self.fail("import from .pyc/.pyo failed: %s" % err)
print("import from .pyc/.pyo failed: %s" % err)
assert(False)
finally:
clean_tmpfiles(source)
unload(TESTFN)

View File

@ -38,6 +38,17 @@ def unload(name):
except KeyError:
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:
path = TESTFN
@ -53,9 +64,9 @@ class Test_Paths:
# Regression test for http://bugs.python.org/issue1293.
def test_trailing_slash(self):
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+'/')
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")

View File

@ -1,5 +1,5 @@
[tox]
envlist = py26, py27
envlist = py26, py27, pypy
; , py33, py34, py35
[testenv]