[svn r37946] setup/teardown hosts correspond

--HG--
branch : trunk
This commit is contained in:
hpk 2007-02-05 01:23:14 +01:00
parent c93cfc1e2b
commit 0b9b0909bf
3 changed files with 8 additions and 12 deletions

View File

@ -127,12 +127,8 @@ class HostManager(object):
finishedcallback=donecallback) finishedcallback=donecallback)
rsync.send(root) rsync.send(root)
def init_hosts(self, reporter): def setup_hosts(self, reporter):
# hosts ready
self.init_rsync(reporter) self.init_rsync(reporter)
return self.setup_nodes(reporter)
def setup_nodes(self, reporter):
nodes = [] nodes = []
for host in self.hosts: for host in self.hosts:
if hasattr(host.gw, 'remote_exec'): # otherwise dummy for tests :/ if hasattr(host.gw, 'remote_exec'): # otherwise dummy for tests :/

View File

@ -133,21 +133,21 @@ class RSession(AbstractSession):
reporter(repevent.TestStarted(hm.hosts)) reporter(repevent.TestStarted(hm.hosts))
try: try:
nodes = hm.init_hosts(reporter) nodes = hm.setup_hosts(reporter)
reporter(repevent.RsyncFinished()) reporter(repevent.RsyncFinished())
try: try:
self.dispatch_tests(nodes, reporter, checkfun) self.dispatch_tests(nodes, reporter, checkfun)
except (KeyboardInterrupt, SystemExit): except (KeyboardInterrupt, SystemExit):
print >>sys.stderr, "C-c pressed waiting for gateways to teardown..." print >>sys.stderr, "C-c pressed waiting for gateways to teardown..."
channels = [node.channel for node in nodes] channels = [node.channel for node in nodes]
hostmanager.kill_channels(channels) hm.kill_channels(channels)
hostmanager.teardown_gateways(reporter, channels) hm.teardown_gateways(reporter, channels)
print >>sys.stderr, "... Done" print >>sys.stderr, "... Done"
raise raise
channels = [node.channel for node in nodes] channels = [node.channel for node in nodes]
hostmanager.teardown_hosts(reporter, channels, nodes, hm.teardown_hosts(reporter, channels, nodes,
exitfirst=self.config.option.exitfirst) exitfirst=self.config.option.exitfirst)
reporter(repevent.Nodes(nodes)) reporter(repevent.Nodes(nodes))
retval = reporter(repevent.TestFinished()) retval = reporter(repevent.TestFinished())
self.kill_server(startserverflag) self.kill_server(startserverflag)

View File

@ -122,7 +122,7 @@ class TestRSessionRemote(DirSetup):
tmpdir = py.test.ensuretemp("emptyconftest") tmpdir = py.test.ensuretemp("emptyconftest")
config = py.test.config._reparse([tmpdir]) config = py.test.config._reparse([tmpdir])
hm = HostManager(config, hosts) hm = HostManager(config, hosts)
nodes = hm.init_hosts(setup_events.append) nodes = hm.setup_hosts(setup_events.append)
hm.teardown_hosts(teardown_events.append, hm.teardown_hosts(teardown_events.append,
[node.channel for node in nodes], nodes) [node.channel for node in nodes], nodes)
@ -147,7 +147,7 @@ class TestRSessionRemote(DirSetup):
config = py.test.config._reparse([]) config = py.test.config._reparse([])
hm = HostManager(config, hosts=hosts) hm = HostManager(config, hosts=hosts)
nodes = hm.init_hosts(allevents.append) nodes = hm.setup_hosts(allevents.append)
from py.__.test.rsession.testing.test_executor \ from py.__.test.rsession.testing.test_executor \
import ItemTestPassing, ItemTestFailing, ItemTestSkipping import ItemTestPassing, ItemTestFailing, ItemTestSkipping