[py-svn] r35590 - py/branch/rsession-cleanup/py/test/rsession
fijal at codespeak.net
fijal at codespeak.net
Mon Dec 11 19:06:37 CET 2006
Author: fijal
Date: Mon Dec 11 19:06:35 2006
New Revision: 35590
Modified:
py/branch/rsession-cleanup/py/test/rsession/master.py
py/branch/rsession-cleanup/py/test/rsession/reporter.py
py/branch/rsession-cleanup/py/test/rsession/slave.py
Log:
Added different behaviour for -x. Mostly that means that exit of clients is immediate (really).
Modified: py/branch/rsession-cleanup/py/test/rsession/master.py
==============================================================================
--- py/branch/rsession-cleanup/py/test/rsession/master.py (original)
+++ py/branch/rsession-cleanup/py/test/rsession/master.py Mon Dec 11 19:06:35 2006
@@ -20,11 +20,14 @@
self.channel, item, repr_outcome))
def send(self, item):
- self.pending.insert(0, item)
- itemspec = item.listnames()[1:]
- self.channel.send(itemspec)
- # send start report
- self.reporter(report.SendItem(self.channel, item))
+ if item is StopIteration:
+ self.channel.send(42)
+ else:
+ self.pending.insert(0, item)
+ itemspec = item.listnames()[1:]
+ self.channel.send(itemspec)
+ # send start report
+ self.reporter(report.SendItem(self.channel, item))
def dispatch_loop(masternodes, itemgenerator, shouldstop,
waiter = lambda: py.std.time.sleep(0.1)):
@@ -37,6 +40,8 @@
if len(node.pending) < max_tasks_per_node:
item = itemgenerator.next()
if shouldstop():
+ for _node in masternodes:
+ _node.send(StopIteration) # magic connector
return
node.send(item)
except StopIteration:
Modified: py/branch/rsession-cleanup/py/test/rsession/reporter.py
==============================================================================
--- py/branch/rsession-cleanup/py/test/rsession/reporter.py (original)
+++ py/branch/rsession-cleanup/py/test/rsession/reporter.py Mon Dec 11 19:06:35 2006
@@ -91,6 +91,8 @@
def hangs(self):
h = []
+ if self.config.option.exitfirst:
+ return
for node in self.nodes:
h += [(i, node.channel.gateway.sshaddress) for i in node.pending]
if h:
Modified: py/branch/rsession-cleanup/py/test/rsession/slave.py
==============================================================================
--- py/branch/rsession-cleanup/py/test/rsession/slave.py (original)
+++ py/branch/rsession-cleanup/py/test/rsession/slave.py Mon Dec 11 19:06:35 2006
@@ -28,7 +28,7 @@
else:
return outcome.make_repr()
-def slave_main(receive, send, path):
+def slave_main(receive, send, path, info = None):
import os
assert os.path.exists(path)
path = os.path.abspath(path)
@@ -61,9 +61,18 @@
while nextitem is not None:
nextitem = receive()
-
+
def setup():
+ def callback_gen(queue):
+ def callback(item):
+ if item == 42: # magic call-cleanup
+ # XXX should kill a pid here
+ sys.exit(0)
+ queue.put(item)
+ return callback
+
import os, sys
+ from Queue import Queue
pkgdir = channel.receive() # path is ready
options = channel.receive() # options stuff, should be dictionary
basedir = os.path.dirname(pkgdir)
@@ -81,6 +90,8 @@
mod = __import__(pkgname)
assert py.path.local(mod.__file__).dirpath() == py.path.local(pkgdir)
from py.__.test.rsession.slave import slave_main
- slave_main(channel.receive, channel.send, basedir)
+ queue = Queue()
+ channel.setcallback(callback_gen(queue))
+ slave_main(queue.get, channel.send, basedir)
if not py.test.remote.nomagic:
py.magic.revoke(assertion=1)
More information about the pytest-commit
mailing list