shift reporting info generation away from terminal reporting time, simplify code.

also get rid of redundant 'shortrepr' on collect/test reports
and rename reportinfo to "location" in some places

--HG--
branch : trunk
This commit is contained in:
holger krekel
2010-09-26 16:23:44 +02:00
parent 7d1585215d
commit 1c020c3d32
21 changed files with 255 additions and 308 deletions

View File

@@ -89,22 +89,7 @@ class TestTerminal:
assert lines[1].endswith("xy.py .")
assert lines[2] == "hello world"
def test_testid(self, testdir, linecomp):
func,method = testdir.getitems("""
def test_func():
pass
class TestClass:
def test_method(self):
pass
""")
tr = TerminalReporter(func.config, file=linecomp.stringio)
id = tr.gettestid(func)
assert id.endswith("test_testid.py::test_func")
fspath = py.path.local(id.split("::")[0])
assert fspath.check()
id = tr.gettestid(method)
assert id.endswith("test_testid.py::TestClass::test_method")
@py.test.mark.xfail(reason="re-implement ItemStart events")
def test_show_path_before_running_test(self, testdir, linecomp):
item = testdir.getitem("def test_func(): pass")
tr = TerminalReporter(item.config, file=linecomp.stringio)
@@ -114,6 +99,7 @@ class TestTerminal:
"*test_show_path_before_running_test.py*"
])
@py.test.mark.xfail(reason="re-implement ItemStart events")
def test_itemreport_reportinfo(self, testdir, linecomp):
testdir.makeconftest("""
import py
@@ -130,6 +116,7 @@ class TestTerminal:
"*ABCDE:43: custom*"
])
@py.test.mark.xfail(reason="re-implement ItemStart events")
def test_itemreport_pytest_report_iteminfo(self, testdir, linecomp):
item = testdir.getitem("def test_func(): pass")
class Plugin:
@@ -144,6 +131,7 @@ class TestTerminal:
"*FGHJ:43: custom*"
])
@py.test.mark.xfail(reason="re-implement subclassing precision reporting")
def test_itemreport_subclasses_show_subclassed_file(self, testdir):
p1 = testdir.makepyfile(test_p1="""
class BaseTests:
@@ -210,8 +198,8 @@ class TestCollectonly:
linecomp.assert_contains_lines([
" <Function 'test_func'>",
])
rep.config.hook.pytest_collectreport(
report=runner.CollectReport(modcol, [], excinfo=None))
report = rep.config.hook.pytest_make_collect_report(collector=modcol)
rep.config.hook.pytest_collectreport(report=report)
assert rep.indent == indent
def test_collectonly_skipped_module(self, testdir, linecomp):