[py-svn] r34487 - py/dist/py/test/rsession

fijal at codespeak.net fijal at codespeak.net
Sat Nov 11 14:30:36 CET 2006


Author: fijal
Date: Sat Nov 11 14:30:34 2006
New Revision: 34487

Modified:
   py/dist/py/test/rsession/hostmanage.py
   py/dist/py/test/rsession/rsession.py
   py/dist/py/test/rsession/slave.py
Log:
Make easier teardown when using -x.


Modified: py/dist/py/test/rsession/hostmanage.py
==============================================================================
--- py/dist/py/test/rsession/hostmanage.py	(original)
+++ py/dist/py/test/rsession/hostmanage.py	Sat Nov 11 14:30:34 2006
@@ -97,11 +97,12 @@
     
     return nodes
 
-def teardown_hosts(reporter, channels, nodes, waiter=lambda : time.sleep(.1)):
+def teardown_hosts(reporter, channels, nodes, waiter=lambda : time.sleep(.1),
+        exitfirst=False):
     for channel in channels:
         channel.send(None)
 
-    clean = False
+    clean = exitfirst
     while not clean:
         clean = True
         for node in nodes:

Modified: py/dist/py/test/rsession/rsession.py
==============================================================================
--- py/dist/py/test/rsession/rsession.py	(original)
+++ py/dist/py/test/rsession/rsession.py	Sat Nov 11 14:30:34 2006
@@ -139,6 +139,7 @@
             remotepython = None
 
         remote_options['nomagic'] = self.config.option.nomagic
+        remote_options['exitfirst'] = self.config.option.exitfirst
         nodes = init_hosts(reporter, sshhosts, directories, pkgdir,
             rsync_roots, remotepython, remote_options=remote_options.d,
             optimise_localhost=self.optimise_localhost)
@@ -155,7 +156,8 @@
         #assert 0, "\n".join([",".join(x.listnames()) for x in 
         #    list(itemgenerator)])
         dispatch_loop(nodes, itemgenerator, checkfun)
-        teardown_hosts(reporter, [node.channel for node in nodes], nodes)
+        teardown_hosts(reporter, [node.channel for node in nodes], nodes, 
+            exitfirst=self.config.option.exitfirst)
         reporter(report.Nodes(nodes))
         reporter(report.TestFinished())
         if startserverflag:

Modified: py/dist/py/test/rsession/slave.py
==============================================================================
--- py/dist/py/test/rsession/slave.py	(original)
+++ py/dist/py/test/rsession/slave.py	Sat Nov 11 14:30:34 2006
@@ -54,8 +54,14 @@
             excinfo = py.code.ExceptionInfo()
             send(Outcome(excinfo=excinfo, is_critical=True).make_repr())
         else:
+            if not res[0] and py.test.remote.exitfirst:
+                # we're finished, but need to eat what we can
+                send(res)
+                break
             send(res)
-
+    
+    while nextitem is not None:
+        nextitem = receive()
 
 def setup():
     default_options = {'nomagic':False} # XXX should come from somewhere else



More information about the pytest-commit mailing list