[svn r63106] rename host -> gateway in a couple of places

--HG--
branch : trunk
This commit is contained in:
hpk 2009-03-20 02:09:28 +01:00
parent bb3ac13917
commit c44764dc51
9 changed files with 37 additions and 46 deletions

View File

@ -108,9 +108,9 @@ class DSession(Session):
elif eventname == "collectionreport":
if ev.passed:
colitems.extend(ev.result)
elif eventname == "hostup":
elif eventname == "testnodeready":
self.addhost(ev.host)
elif eventname == "hostdown":
elif eventname == "testnodedown":
pending = self.removehost(ev.host)
if pending:
crashitem = pending.pop(0)
@ -132,9 +132,9 @@ class DSession(Session):
# once we are in shutdown mode we dont send
# events other than HostDown upstream
eventname, args, kwargs = self.queue.get()
if eventname == "hostdown":
if eventname == "testnodedown":
ev, = args
self.bus.notify("hostdown", ev)
self.bus.notify("testnodedown", ev)
self.removehost(ev.host)
if not self.host2pending:
# finished
@ -173,7 +173,7 @@ class DSession(Session):
try:
pending = self.host2pending.pop(host)
except KeyError:
# this happens if we didn't receive a hostup event yet
# this happens if we didn't receive a testnodeready event yet
return []
for item in pending:
del self.item2host[item]

View File

@ -33,11 +33,11 @@ class MasterNode(object):
if not self._down:
if not err:
err = "TERMINATED"
self.notify("hostdown", event.HostDown(self.host, err))
self.notify("testnodedown", event.HostDown(self.host, err))
return
elif eventcall is None:
self._down = True
self.notify("hostdown", event.HostDown(self.host, None))
self.notify("testnodedown", event.HostDown(self.host, None))
return
except KeyboardInterrupt:
raise
@ -95,7 +95,7 @@ class SlaveNode(object):
if basetemp:
self.config.basetemp = py.path.local(basetemp)
self.config.pytestplugins.do_configure(self.config)
self.sendevent("hostup", makehostup(host))
self.sendevent("testnodeready", maketestnodeready(host))
try:
while 1:
task = channel.receive()
@ -120,7 +120,7 @@ class SlaveNode(object):
self.sendevent("itemtestreport", testrep)
def makehostup(host="INPROCESS"):
def maketestnodeready(host="INPROCESS"):
import sys
platinfo = {}
for name in 'platform', 'executable', 'version_info':

View File

@ -1,5 +1,5 @@
from py.__.test.dsession.dsession import DSession, LoopState
from py.__.test.dsession.masterslave import makehostup
from py.__.test.dsession.masterslave import maketestnodeready
from py.__.execnet.gwmanage import GatewaySpec
from py.__.test.runner import basic_collect_report
from py.__.test import event
@ -146,7 +146,7 @@ class TestDSession:
# setup a HostDown event
ev = event.HostDown(host1, None)
session.queueevent("hostdown", ev)
session.queueevent("testnodedown", ev)
loopstate = LoopState([item])
loopstate.dowork = False
@ -154,7 +154,7 @@ class TestDSession:
dumpqueue(session.queue)
assert loopstate.exitstatus == outcome.EXIT_NOHOSTS
def test_hostdown_causes_reschedule_pending(self, testdir, EventRecorder):
def test_testnodedown_causes_reschedule_pending(self, testdir, EventRecorder):
modcol = testdir.getmodulecol("""
def test_crash():
assert 0
@ -176,7 +176,7 @@ class TestDSession:
session.senditems([item1, item2])
host = session.item2host[item1]
ev = event.HostDown(host, None)
session.queueevent("hostdown", ev)
session.queueevent("testnodedown", ev)
evrec = EventRecorder(session.bus)
loopstate = LoopState([])
session.loop_once(loopstate)
@ -188,13 +188,13 @@ class TestDSession:
assert str(testrep.longrepr).find("crashed") != -1
assert str(testrep.longrepr).find(host.address) != -1
def test_hostup_adds_to_available(self, testdir):
def test_testnodeready_adds_to_available(self, testdir):
item = testdir.getitem("def test_func(): pass")
# setup a session with two hosts
session = DSession(item.config)
host1 = GatewaySpec("localhost")
hostup = makehostup(host1)
session.queueevent("hostup", hostup)
testnodeready = maketestnodeready(host1)
session.queueevent("testnodeready", testnodeready)
loopstate = LoopState([item])
loopstate.dowork = False
assert len(session.host2pending) == 0
@ -225,7 +225,7 @@ class TestDSession:
session.queueevent("itemtestreport", ev)
session.loop_once(loopstate)
assert loopstate.shuttingdown
session.queueevent("hostdown", event.HostDown(host1, None))
session.queueevent("testnodedown", event.HostDown(host1, None))
session.loop_once(loopstate)
dumpqueue(session.queue)
return session, loopstate.exitstatus
@ -278,11 +278,11 @@ class TestDSession:
evrec = EventRecorder(session.bus)
session.queueevent("itemtestreport", run(item))
session.loop_once(loopstate)
assert not evrec.getfirstnamed("hostdown")
assert not evrec.getfirstnamed("testnodedown")
ev = event.HostDown(host)
session.queueevent("hostdown", ev)
session.queueevent("testnodedown", ev)
session.loop_once(loopstate)
assert evrec.getfirstnamed('hostdown') == ev
assert evrec.getfirstnamed('testnodedown') == ev
def test_filteritems(self, testdir, EventRecorder):
modcol = testdir.getmodulecol("""
@ -313,7 +313,7 @@ class TestDSession:
assert event.name == "deselected"
assert event.args[0].items == [items[1]]
def test_hostdown_shutdown_after_completion(self, testdir):
def test_testnodedown_shutdown_after_completion(self, testdir):
item = testdir.getitem("def test_func(): pass")
session = DSession(item.config)
@ -325,9 +325,9 @@ class TestDSession:
loopstate = LoopState([])
session.loop_once(loopstate)
assert host.node._shutdown is True
assert loopstate.exitstatus is None, "loop did not wait for hostdown"
assert loopstate.exitstatus is None, "loop did not wait for testnodedown"
assert loopstate.shuttingdown
session.queueevent("hostdown", event.HostDown(host, None))
session.queueevent("testnodedown", event.HostDown(host, None))
session.loop_once(loopstate)
assert loopstate.exitstatus == 0

View File

@ -53,7 +53,7 @@ class TestAsyncFunctional:
ev, = eq.geteventargs("itemtestreport")
assert ev.failed
# see that the host is really down
ev, = eq.geteventargs("hostdown")
ev, = eq.geteventargs("testnodedown")
assert ev.host.address == "popen"
ev, = eq.geteventargs("testrunfinish")

View File

@ -147,15 +147,6 @@ class TestHostManager:
ev = sorter.getfirstnamed("itemtestreport")
assert ev.passed
def test_rsync_samehost_twice(self):
host1 = Host("%s" % (sshhost, ))
host2 = Host("%s" % (sshhost, ))
hm = HostManager(config, hosts=[host1, host2])
events = []
hm.init_rsync(events.append)
print events
assert 0
def test_getconfiggwspecs_numprocesses():
config = py.test.config._reparse(['-n3'])

View File

@ -70,7 +70,7 @@ class TestMasterSlaveConnection:
def test_crash_invalid_item(self, mysetup):
node = mysetup.makenode()
node.send(123) # invalid item
ev, = mysetup.geteventargs("hostdown")
ev, = mysetup.geteventargs("testnodedown")
assert ev.host == mysetup.host
assert str(ev.error).find("AttributeError") != -1
@ -84,19 +84,19 @@ class TestMasterSlaveConnection:
""")
node = mysetup.makenode(item.config)
node.send(item)
ev, = mysetup.geteventargs("hostdown")
ev, = mysetup.geteventargs("testnodedown")
assert ev.host == mysetup.host
assert str(ev.error).find("TERMINATED") != -1
def test_node_down(self, mysetup):
node = mysetup.makenode()
node.shutdown()
ev, = mysetup.geteventargs("hostdown")
ev, = mysetup.geteventargs("testnodedown")
assert ev.host == mysetup.host
assert not ev.error
node.callback(node.ENDMARK)
excinfo = py.test.raises(IOError,
"mysetup.geteventargs('hostdown', timeout=0.01)")
"mysetup.geteventargs('testnodedown', timeout=0.01)")
def test_send_on_closed_channel(self, testdir, mysetup):
item = testdir.getitem("def test_func(): pass")

View File

@ -200,10 +200,10 @@ class PytestPluginHooks:
within the gateway manager context.
"""
def pyevent_hostup(self, event):
def pyevent_testnodeready(self, event):
""" Host is up. """
def pyevent_hostdown(self, event):
def pyevent_testnodedown(self, event):
""" Host is down. """
def pyevent_rescheduleitems(self, event):

View File

@ -103,7 +103,7 @@ class TerminalReporter:
# which garbles our output if we use self.write_line
self.write_line(msg)
def pyevent_hostup(self, event):
def pyevent_testnodeready(self, event):
d = event.platinfo.copy()
d['host'] = getattr(event.host, 'address', event.host)
d['version'] = repr_pythonversion(d['sys.version_info'])
@ -111,7 +111,7 @@ class TerminalReporter:
"%(sys.executable)s - Python %(version)s" %
d)
def pyevent_hostdown(self, event):
def pyevent_testnodedown(self, event):
host = event.host
error = event.error
if error:
@ -323,13 +323,13 @@ def repr_pythonversion(v=None):
from py.__.test import event
from py.__.test.runner import basic_run_report
from py.__.test.dsession.masterslave import makehostup
from py.__.test.dsession.masterslave import maketestnodeready
class TestTerminal:
def test_hostup(self, testdir, linecomp):
def test_testnodeready(self, testdir, linecomp):
item = testdir.getitem("def test_func(): pass")
rep = TerminalReporter(item.config, linecomp.stringio)
rep.pyevent_hostup(makehostup())
rep.pyevent_testnodeready(maketestnodeready())
linecomp.assert_contains_lines([
"*INPROCESS* %s %s - Python %s" %(sys.platform,
sys.executable, repr_pythonversion(sys.version_info))

View File

@ -12,7 +12,7 @@ from py.__.test import event, outcome
Item = py.test.collect.Item
Collector = py.test.collect.Collector
from runner import basic_collect_report
from py.__.test.dsession.masterslave import makehostup
from py.__.test.dsession.masterslave import maketestnodeready
class Session(object):
"""
@ -117,7 +117,7 @@ class Session(object):
colitems = self.getinitialitems(colitems)
self.shouldstop = False
self.sessionstarts()
self.bus.notify("hostup", makehostup())
self.bus.notify("testnodeready", maketestnodeready())
exitstatus = outcome.EXIT_OK
captured_excinfo = None
try: