[py-svn] r31506 - in py/branch/distributed/py/test/rsession: . testing

hpk at codespeak.net hpk at codespeak.net
Tue Aug 22 20:49:57 CEST 2006


Author: hpk
Date: Tue Aug 22 20:49:54 2006
New Revision: 31506

Modified:
   py/branch/distributed/py/test/rsession/master.py
   py/branch/distributed/py/test/rsession/slave.py
   py/branch/distributed/py/test/rsession/testing/test_dispatcher.py
Log:
(fijal, hpk) reintroduce sending of (a relative) path for setting up slaves. 


Modified: py/branch/distributed/py/test/rsession/master.py
==============================================================================
--- py/branch/distributed/py/test/rsession/master.py	(original)
+++ py/branch/distributed/py/test/rsession/master.py	Tue Aug 22 20:49:54 2006
@@ -35,18 +35,34 @@
                     node.send(item)
         except StopIteration:
             break
-        event.wait(3)
+        event.wait(3)  # XXX argh 
         event.clear()
 
-def setup_slave(gateway):
-    from py.__.test.rsession.slave import setup
-    
-    ch = gateway.remote_exec(py.code.Source(setup, "setup()"))
-    return ch
 
+_rsync = py.path.local.sysfind("rsync")
+def bin_rsync(source, sshaddress, destpath):
+    rsync.execute("-az", "--delete", "--exclude=.svn", 
+                  source, sshaddress + ":" + str(destpath))
+
+def setup_slave(gateway, destpath):
+    from py.__.test.rsession import slave 
+    ch = gateway.remote_exec(py.code.Source(slave.setup, "setup()"))
+    ch.send(str(destpath))
+    return ch 
+    
+#def setup_(gateway, rootdir, report, path="pytest_cache"):
+#    bin_rsync(rootdir, gateway.sshaddress, path)
+#    return MasterNode(ch, report)
+#
+#def main():
+    
 # master side: 
 # gw = SshGateway(sshhost)
-# rsync -az --delete --exclude=.svn %(source)s %(sshhost)s:%(path)s
+#
+# setup_slave(gw)
+# path = "pytest_cache"
+# rsync(rootdir, gw.sshhost, path)
+# pytest_cache -az --delete --exclude=.svn %(source)s %(sshhost)s:%(path)s
 # c = gw.remote_exec(slave_main) 
 # c.send(path)
 #

Modified: py/branch/distributed/py/test/rsession/slave.py
==============================================================================
--- py/branch/distributed/py/test/rsession/slave.py	(original)
+++ py/branch/distributed/py/test/rsession/slave.py	Tue Aug 22 20:49:54 2006
@@ -29,9 +29,9 @@
         send(res)
 
 def setup():
-    # XXX: let's assume that we're always testing relatively to pylib dir
-    import py
+    base_path = channel.receive()   # path is ready 
+    import os, sys
+    base_path = os.path.abspath(base_path) 
+    sys.path.insert(0, base_path)
     from py.__.test.rsession.slave import slave_main
-    
-    base_path = str(py.path.local(py.__file__).dirpath().dirpath())    
     slave_main(channel.receive, channel.send, base_path)

Modified: py/branch/distributed/py/test/rsession/testing/test_dispatcher.py
==============================================================================
--- py/branch/distributed/py/test/rsession/testing/test_dispatcher.py	(original)
+++ py/branch/distributed/py/test/rsession/testing/test_dispatcher.py	Tue Aug 22 20:49:54 2006
@@ -40,7 +40,7 @@
 
 def test_slave_setup():
     gw = py.execnet.PopenGateway()
-    channel = setup_slave(gw)
+    channel = setup_slave(gw, rootdir)
     channel.send(funcpass_spec)
     output = ReprOutcome(channel.receive())
     assert output.passed
@@ -61,7 +61,7 @@
     
     def open_gw():
         gw = py.execnet.PopenGateway()
-        channel = setup_slave(gw)
+        channel = setup_slave(gw, rootdir)
         mn = MasterNode(channel, simple_reporter)
         return mn
     



More information about the pytest-commit mailing list