[py-svn] r31831 - py/branch/distributed/py/test/rsession

arigo at codespeak.net arigo at codespeak.net
Wed Aug 30 14:22:36 CEST 2006


Author: arigo
Date: Wed Aug 30 14:22:35 2006
New Revision: 31831

Modified:
   py/branch/distributed/py/test/rsession/hostmanage.py
   py/branch/distributed/py/test/rsession/rsession.py
Log:
Optional distrsync_files setting in conftest.py to specify which files
from the pkgdir must be rsync'ed.  For example, for pypy, give

    distrsync_files = ['pypy', 'lib-python', 'py']

to skip directories like 'demo' and 'testresult'.


Modified: py/branch/distributed/py/test/rsession/hostmanage.py
==============================================================================
--- py/branch/distributed/py/test/rsession/hostmanage.py	(original)
+++ py/branch/distributed/py/test/rsession/hostmanage.py	Wed Aug 30 14:22:35 2006
@@ -7,7 +7,7 @@
 
 from py.__.test.rsession.conftest import option
 
-def init_hosts(reporter, sshhosts, relpath, pkgdir):
+def init_hosts(reporter, sshhosts, relpath, pkgdir, rsync_files=['']):
     assert pkgdir.join("__init__.py").check(), (
             "%s probably wrong" %(pkgdir,))
     assert relpath, relpath
@@ -21,8 +21,10 @@
         # XXX: because of NFS we do create different directories
         #      otherwise, .pyc files overlap
         real_relpath = relpath + "-" + host
-        report.wrapcall(reporter, bin_rsync, 
-                        str(pkgdir.dirpath())+"/", host, real_relpath)
+        sources = []
+        for basename in rsync_files:
+            sources.append(str(pkgdir.dirpath())+"/"+basename)
+        report.wrapcall(reporter, bin_rsync, sources, host, real_relpath)
         gw = py.execnet.SshGateway(host)
         ch = setup_slave(gw, os.path.join(real_relpath, pkgdir.basename))
         nodes.append(MasterNode(ch, reporter))
@@ -46,11 +48,15 @@
             pass
         channel.gateway.exit()
 
-def bin_rsync(source, sshaddress, destpath):
+def bin_rsync(sources, sshaddress, destpath):
     _rsync = py.path.local.sysfind("rsync")
     assert destpath
-    _rsync.sysexec("-az", "--delete-excluded", 
-                   "--delete", "--exclude=.svn/", "--exclude=*.pyc",
-                  str(source) + "/", sshaddress + ":" + str(destpath))
-
-
+    args = ["-az", "--delete-excluded",
+            "--delete", "--exclude=.svn/", "--exclude=*.pyc"]
+    if isinstance(sources, list):
+        args += sources
+    else:
+        args.append(str(sources) + "/")
+    args.append(sshaddress + ":" + str(destpath))
+    print '*', 'rsync', ' '.join(args)
+    _rsync.sysexec(*args)

Modified: py/branch/distributed/py/test/rsession/rsession.py
==============================================================================
--- py/branch/distributed/py/test/rsession/rsession.py	(original)
+++ py/branch/distributed/py/test/rsession/rsession.py	Wed Aug 30 14:22:35 2006
@@ -204,6 +204,10 @@
             args = [py.path.local()]
         sshhosts = self.config.getinitialvalue("disthosts")
         try:
+            rsync_files = self.config.getinitialvalue("distrsync_files")
+        except:
+            rsync_files = ['']    # all files and directories in the pkgdir
+        try:
             # XXX: use it like a command line option, but how?
             startserverflag = self.config.getinitialvalue("startserver")
         except:
@@ -220,7 +224,8 @@
         colitems = self.make_colitems(args, baseon=pkgdir.dirpath())
 
         destrelpath = "pytestcache"
-        nodes = init_hosts(reporter, sshhosts, destrelpath, pkgdir)
+        nodes = init_hosts(reporter, sshhosts, destrelpath, pkgdir,
+                           rsync_files)
         
         def reporterror(data):
             excinfo, item = data



More information about the pytest-commit mailing list