turn some tests from skipped to xfail

strike dead code, small refinements to xfail exception reporting

--HG--
branch : 1.0.x
This commit is contained in:
holger krekel 2009-08-09 23:46:27 +02:00
parent d41949a6e3
commit 5c8df1d4ca
6 changed files with 22 additions and 11 deletions

View File

@ -39,8 +39,7 @@ class ExceptionInfo(object):
"""
lines = py.std.traceback.format_exception_only(self.type, self.value)
text = ''.join(lines)
if text.endswith('\n'):
text = text[:-1]
text = text.rstrip()
if tryshort:
if text.startswith(self._striptext):
text = text[len(self._striptext):]

View File

@ -200,6 +200,11 @@ def test_tbentry_reinterpret():
def test_excinfo_exconly():
excinfo = py.test.raises(ValueError, h)
assert excinfo.exconly().startswith('ValueError')
excinfo = py.test.raises(ValueError,
"raise ValueError('hello\\nworld')")
msg = excinfo.exconly(tryshort=True)
assert msg.startswith('ValueError')
assert msg.endswith("world")
def test_excinfo_repr():
excinfo = py.test.raises(ValueError, h)
@ -242,7 +247,6 @@ def test_entrysource_Queue_example():
assert s.startswith("def get")
def test_codepath_Queue_example():
py.test.skip("try harder to get at the paths of code objects.")
import Queue
try:
Queue.Queue().get(timeout=0.001)

View File

@ -173,8 +173,8 @@ class TestSourceParsingAndCompiling:
assert len(source) == 6
assert source.getstatementrange(2) == (1, 4)
@py.test.mark.xfail
def test_getstatementrange_bug2(self):
py.test.skip("fix me (issue19)")
source = Source("""\
assert (
33
@ -300,8 +300,8 @@ def test_deindent():
lines = deindent(source.splitlines())
assert lines == ['', 'def f():', ' def g():', ' pass', ' ']
@py.test.mark.xfail
def test_source_of_class_at_eof_without_newline():
py.test.skip("CPython's inspect.getsource is buggy")
# this test fails because the implicit inspect.getsource(A) below
# does not return the "x = 1" last line.
tmpdir = py.test.ensuretemp("source_write_read")

View File

@ -19,8 +19,6 @@ when it fails. Instead terminal reporting will list it in the
import py
pytest_plugins = ['keyword']
def pytest_runtest_makereport(__call__, item, call):
if call.when != "call":
return
@ -53,6 +51,9 @@ def pytest_terminal_summary(terminalreporter):
modpath = rep.item.getmodpath(includemodule=True)
pos = "%s %s:%d: " %(modpath, entry.path, entry.lineno)
reason = rep.longrepr.reprcrash.message
i = reason.find("\n")
if i != -1:
reason = reason[:i]
tr._tw.line("%s %s" %(pos, reason))
xpassed = terminalreporter.stats.get("xpassed")
@ -89,3 +90,4 @@ def test_xfail(testdir):
"*test_that*",
])
assert result.ret == 1

View File

@ -200,9 +200,6 @@ class PluginManager(object):
config.hook.pytest_unconfigure(config=config)
config.pluginmanager.unregister(self)
class Ext:
""" namespace for extension objects. """
#
# XXX old code to automatically load classes
#

View File

@ -185,7 +185,7 @@ class TestPytestPluginInteractions:
assert hello == "world"
""")
result = testdir.runpytest(p)
assert result.stdout.fnmatch_lines([
result.stdout.fnmatch_lines([
"*1 passed*"
])
@ -247,3 +247,12 @@ def test_collectattr():
assert list(methods) == ['pytest_hello', 'pytest_world']
methods = py.builtin.sorted(collectattr(B()))
assert list(methods) == ['pytest_hello', 'pytest_world']
@py.test.mark.xfail
def test_namespace_has_default_and_env_plugins(testdir):
p = testdir.makepyfile("""
import py
py.test.mark
""")
result = testdir.runpython(p)
assert result.ret == 0