another couple of checks on jython, still some problems
--HG-- branch : trunk
This commit is contained in:
parent
221ac3e466
commit
b3a05b545e
|
@ -1,6 +1,10 @@
|
|||
import re
|
||||
import sys
|
||||
import parser
|
||||
|
||||
try:
|
||||
import parser
|
||||
except ImportError:
|
||||
parser = None
|
||||
|
||||
d={}
|
||||
# d is the dictionary of unittest changes, keyed to the old name
|
||||
|
|
|
@ -523,7 +523,8 @@ class FormattedExcinfo(object):
|
|||
source = py.code.Source("???")
|
||||
line_index = 0
|
||||
else:
|
||||
line_index = entry.lineno - entry.getfirstlinesource()
|
||||
# entry.getfirstlinesource() can be -1, should be 0 on jython
|
||||
line_index = entry.lineno - max(entry.getfirstlinesource(), 0)
|
||||
|
||||
lines = []
|
||||
if self.style == "long":
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
import py
|
||||
py.test.importorskip("parser")
|
||||
from py._cmdline.pyconvert_unittest import rewrite_utest
|
||||
|
||||
|
||||
|
|
|
@ -132,7 +132,7 @@ class CommonFSTests(object):
|
|||
assert not l1.relto(l2)
|
||||
assert not l2.relto(l1)
|
||||
|
||||
#@py.test.mark.xfail("sys.platform.startswith('java')")
|
||||
@py.test.mark.xfail("sys.platform.startswith('java')")
|
||||
def test_listdir(self, path1):
|
||||
l = path1.listdir()
|
||||
assert path1.join('sampledir') in l
|
||||
|
@ -178,7 +178,7 @@ class CommonFSTests(object):
|
|||
assert "sampledir" in l
|
||||
assert "otherdir" in l
|
||||
|
||||
#@py.test.mark.xfail("sys.platform.startswith('java')")
|
||||
@py.test.mark.xfail("sys.platform.startswith('java')")
|
||||
def test_visit_ignore(self, path1):
|
||||
p = path1.join('nonexisting')
|
||||
assert list(p.visit(ignore=py.error.ENOENT)) == []
|
||||
|
|
|
@ -13,6 +13,12 @@ class TestSvnURLCommandPath(CommonSvnTests):
|
|||
def test_load(self, path1):
|
||||
super(TestSvnURLCommandPath, self).test_load(path1)
|
||||
|
||||
# the following two work on jython but not in local/svnwc
|
||||
def test_listdir(self, path1):
|
||||
super(TestSvnURLCommandPath, self).test_listdir(path1)
|
||||
def test_visit_ignore(self, path1):
|
||||
super(TestSvnURLCommandPath, self).test_visit_ignore(path1)
|
||||
|
||||
def test_svnurl_needs_arg(self, path1):
|
||||
py.test.raises(TypeError, "py.path.svnurl()")
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import py
|
||||
import sys
|
||||
import os, sys
|
||||
from py._plugin.pytest__pytest import HookRecorder
|
||||
from py._test.pluginmanager import Registry
|
||||
|
||||
|
@ -17,7 +17,7 @@ def test_hookrecorder_basic():
|
|||
|
||||
def test_hookrecorder_basic_no_args_hook():
|
||||
rec = HookRecorder(Registry())
|
||||
apimod = type(sys)('api')
|
||||
apimod = type(os)('api')
|
||||
def xyz():
|
||||
pass
|
||||
apimod.xyz = xyz
|
||||
|
|
|
@ -82,7 +82,7 @@ class TestTerminal:
|
|||
])
|
||||
|
||||
def test_collect_fail(self, testdir, option):
|
||||
p = testdir.makepyfile("import xyz")
|
||||
p = testdir.makepyfile("import xyz\n")
|
||||
result = testdir.runpytest(*option._getcmdargs())
|
||||
result.stdout.fnmatch_lines([
|
||||
"*test_collect_fail.py E*",
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
import py
|
||||
import sys, os
|
||||
|
||||
def fass():
|
||||
assert 1 == 2
|
||||
def check_assertion():
|
||||
excinfo = py.test.raises(AssertionError, "assert 1 == 2")
|
||||
excinfo = py.test.raises(AssertionError, fass)
|
||||
s = excinfo.exconly(tryshort=True)
|
||||
if not s == "assert 1 == 2":
|
||||
raise ValueError("assertion not enabled: got %s" % s)
|
||||
|
@ -16,6 +18,7 @@ def test_invoke_assertion(recwarn, monkeypatch):
|
|||
py.magic.revoke(assertion=True)
|
||||
recwarn.pop(DeprecationWarning)
|
||||
|
||||
@py.test.mark.skipif("sys.platform.startswith('java')")
|
||||
def test_invoke_compile(recwarn, monkeypatch):
|
||||
monkeypatch.setattr(py.builtin.builtins, 'compile', None)
|
||||
py.magic.invoke(compile=True)
|
||||
|
|
|
@ -9,7 +9,7 @@ def checksubpackage(name):
|
|||
keys = dir(obj)
|
||||
assert len(keys) > 0
|
||||
print (obj.__map__)
|
||||
for name in obj.__map__:
|
||||
for name in list(obj.__map__):
|
||||
assert hasattr(obj, name), (obj, name)
|
||||
|
||||
def test_dir():
|
||||
|
|
Loading…
Reference in New Issue