Files
pytest2/py/test/testing/test_repevent.py
hpk 494ea31042 [svn r57744] Merging collection-API refactoring branch:
* collectors now have a collect() method
* items have a runtest() method
* deprecated old run/join of collectors and
  run/execute methods of items

--HG--
branch : trunk
2008-09-02 10:58:14 +02:00

31 lines
857 B
Python

from py.__.test import event
import setupdata, suptest
from py.__.code.testing.test_excinfo import TWMock
class TestItemTestReport(object):
def test_toterminal(self):
sorter = suptest.events_run_example("file_test.py")
reports = sorter.get(event.ItemTestReport)
ev = reports[0]
assert ev.failed
twmock = TWMock()
ev.toterminal(twmock)
assert twmock.lines
twmock = TWMock()
ev.outcome.longrepr = "hello"
ev.toterminal(twmock)
assert twmock.lines[0] == "hello"
assert not twmock.lines[1:]
##assert ev.repr_run.find("AssertionError") != -1
filepath = ev.colitem.fspath
#filepath , modpath = ev.itemrepr_path
assert str(filepath).endswith("file_test.py")
#assert modpath.endswith("file_test.test_one")