[svn r45646] Rewrite it a bit not to rely on exact formatting (rather checking whether

information is there)

--HG--
branch : trunk
This commit is contained in:
fijal 2007-08-14 11:45:04 +02:00
parent 8ce22f32ac
commit 5318f7b145
2 changed files with 19 additions and 28 deletions

View File

@ -18,7 +18,6 @@ etc.
import py, os
#py.test.skip("in progress")
from py.__.test.rsession.rsession import LocalReporter, AbstractSession,\
RemoteReporter
from py.__.test.rsession import repevent
@ -173,23 +172,19 @@ class TestLocalReporter(AbstractTestReporter):
reporter = LocalReporter
def test_report_received_item_outcome(self):
#py.test.skip("XXX rewrite test to not rely on exact formatting")
assert self.report_received_item_outcome() == 'FsF.'
def test_module(self):
#py.test.skip("XXX rewrite test to not rely on exact formatting")
output = self._test_module()
assert output.find("test_one") != -1
assert output.endswith("FsF."), output
def test_full_module(self):
#py.test.skip("XXX rewrite test to not rely on exact formatting")
received = self._test_full_module()
expected = """
repmod/test_one.py[1]
repmod/test_three.py[0] - FAILED TO LOAD MODULE
repmod/test_two.py[0] - skipped (reason)"""
assert received.find(expected) != -1
expected_lst = ["repmod/test_one.py", "FAILED TO LOAD MODULE",
"skipped", "reason"]
for i in expected_lst:
assert received.find(i) != -1
class TestRemoteReporter(AbstractTestReporter):
reporter = RemoteReporter
@ -198,28 +193,24 @@ class TestRemoteReporter(AbstractTestReporter):
self._test_still_to_go()
def test_report_received_item_outcome(self):
py.test.skip("XXX rewrite test to not rely on exact formatting")
val = self.report_received_item_outcome()
expected = """ localhost: FAILED py.test.rsession.testing.test_slave.py funcpass
localhost: SKIPPED py.test.rsession.testing.test_slave.py funcpass
localhost: FAILED py.test.rsession.testing.test_slave.py funcpass
localhost: PASSED py.test.rsession.testing.test_slave.py funcpass
"""
expected_lst = ["localhost", "FAILED",
"funcpass", "test_one",
"SKIPPED",
"PASSED"]
for expected in expected_lst:
assert val.find(expected) != -1
def test_module(self):
py.test.skip("XXX rewrite test to not rely on exact formatting")
val = self._test_module()
print val
expected = """ localhost: FAILED py.test.rsession.testing.test_slave.py funcpass
localhost: SKIPPED py.test.rsession.testing.test_slave.py funcpass
localhost: FAILED py.test.rsession.testing.test_slave.py funcpass
localhost: PASSED py.test.rsession.testing.test_slave.py funcpass
"""
expected_lst = ["localhost", "FAILED",
"funcpass", "test_one",
"SKIPPED",
"PASSED"]
for expected in expected_lst:
assert val.find(expected) != -1
def test_full_module(self):
#py.test.skip("XXX rewrite test to not rely on exact formatting")
val = self._test_full_module()
assert val.find('FAILED TO LOAD MODULE: repmod/test_three.py\n'\
'\nSkipped (reason) repmod/test_two.py') != -1
assert val.find("FAILED TO LOAD MODULE: repmod/test_three.py\n"\
"\nSkipped ('reason') repmod/test_two.py") != -1

View File

@ -29,7 +29,7 @@ def test_example_tryiter():
rootcol = py.test.collect.Directory(tmpdir)
data = list(rootcol._tryiter(reporterror=events.append))
assert len(events) == 2
assert str(events[1][0].value) == "Reason"
assert str(events[1][0].value).find("Reason") != -1
class TestRSessionRemote(DirSetup, BasicRsessionTest):
def test_example_distribution_minus_x(self):