2007-01-24 22:24:01 +08:00
|
|
|
|
|
|
|
""" Testing the slave side node code (in a local way). """
|
2007-02-11 00:50:47 +08:00
|
|
|
from py.__.test.rsession.slave import SlaveNode, slave_main, setup
|
2007-01-24 22:24:01 +08:00
|
|
|
from py.__.test.rsession.outcome import ReprOutcome
|
|
|
|
import py, sys
|
2007-02-07 04:28:07 +08:00
|
|
|
from py.__.test.rsession.testing.basetest import BasicRsessionTest
|
2007-01-24 22:24:01 +08:00
|
|
|
|
|
|
|
modlevel = []
|
|
|
|
import os
|
|
|
|
|
|
|
|
if sys.platform == 'win32':
|
|
|
|
py.test.skip("rsession is unsupported on Windows.")
|
|
|
|
|
|
|
|
# ----------------------------------------------------------------------
|
|
|
|
|
|
|
|
from py.__.test.rsession.executor import RunExecutor
|
|
|
|
|
2007-02-07 04:05:55 +08:00
|
|
|
class TestSlave(BasicRsessionTest):
|
|
|
|
def gettestnode(self):
|
2007-02-11 00:50:47 +08:00
|
|
|
node = SlaveNode(self.config, executor=RunExecutor)
|
2007-02-07 04:05:55 +08:00
|
|
|
return node
|
|
|
|
|
|
|
|
def test_slave_run_passing(self):
|
|
|
|
node = self.gettestnode()
|
2007-02-07 04:28:07 +08:00
|
|
|
item = self.getexample("pass")
|
2007-02-07 04:05:55 +08:00
|
|
|
outcome = node.execute(item._get_collector_trail())
|
|
|
|
assert outcome.passed
|
|
|
|
assert not outcome.setupfailure
|
|
|
|
|
|
|
|
ser = outcome.make_repr()
|
|
|
|
reproutcome = ReprOutcome(ser)
|
|
|
|
assert reproutcome.passed
|
|
|
|
assert not reproutcome.setupfailure
|
|
|
|
|
|
|
|
def test_slave_run_failing(self):
|
|
|
|
node = self.gettestnode()
|
2007-02-07 04:28:07 +08:00
|
|
|
item = self.getexample("fail")
|
2007-02-07 04:05:55 +08:00
|
|
|
outcome = node.execute(item._get_collector_trail())
|
|
|
|
assert not outcome.passed
|
|
|
|
assert not outcome.setupfailure
|
|
|
|
assert len(outcome.excinfo.traceback) == 1
|
|
|
|
assert outcome.excinfo.traceback[-1].frame.code.name == 'funcfail'
|
|
|
|
|
|
|
|
ser = outcome.make_repr()
|
|
|
|
reproutcome = ReprOutcome(ser)
|
|
|
|
assert not reproutcome.passed
|
|
|
|
assert not reproutcome.setupfailure
|
|
|
|
assert reproutcome.excinfo
|
2007-01-24 22:24:01 +08:00
|
|
|
|
2007-02-07 04:05:55 +08:00
|
|
|
def test_slave_run_skipping(self):
|
|
|
|
node = self.gettestnode()
|
2007-02-07 04:28:07 +08:00
|
|
|
item = self.getexample("skip")
|
2007-02-07 04:05:55 +08:00
|
|
|
outcome = node.execute(item._get_collector_trail())
|
|
|
|
assert not outcome.passed
|
|
|
|
assert outcome.skipped
|
|
|
|
|
|
|
|
ser = outcome.make_repr()
|
|
|
|
reproutcome = ReprOutcome(ser)
|
|
|
|
assert not reproutcome.passed
|
|
|
|
assert reproutcome.skipped
|
|
|
|
|
|
|
|
def test_slave_run_failing_wrapped(self):
|
|
|
|
node = self.gettestnode()
|
2007-02-07 04:28:07 +08:00
|
|
|
item = self.getexample("fail")
|
2007-02-07 04:05:55 +08:00
|
|
|
repr_outcome = node.run(item._get_collector_trail())
|
|
|
|
outcome = ReprOutcome(repr_outcome)
|
|
|
|
assert not outcome.passed
|
|
|
|
assert not outcome.setupfailure
|
|
|
|
assert outcome.excinfo
|
|
|
|
|
|
|
|
def test_slave_run_different_stuff(self):
|
|
|
|
py.test.skip("XXX not this way")
|
|
|
|
node = self.gettestnode()
|
|
|
|
node.run(self.rootcol._getitembynames("py doc log.txt".split()).
|
|
|
|
_get_collector_trail())
|