[py-svn] r38040 - py/trunk/py/test/rsession

fijal at codespeak.net fijal at codespeak.net
Wed Feb 7 00:13:53 CET 2007


Author: fijal
Date: Wed Feb  7 00:13:50 2007
New Revision: 38040

Modified:
   py/trunk/py/test/rsession/hostmanage.py
Log:
My favorite lazy-lexical-scope-binding error. Still thinking how to make test 
for that. Basically - callbacks with lexical scope variables are usually
(depends of coz) called with variables after the for loop has finished.


Modified: py/trunk/py/test/rsession/hostmanage.py
==============================================================================
--- py/trunk/py/test/rsession/hostmanage.py	(original)
+++ py/trunk/py/test/rsession/hostmanage.py	Wed Feb  7 00:13:50 2007
@@ -133,10 +133,11 @@
                               verbose=self.config.option.verbose)
             destrelpath = root.relto(self.config.topdir)
             for host in self.hosts:
-                def donecallback():
+                def donecallback(host, root):
                     reporter(repevent.HostRSyncRootReady(host, root))
                 remotepath = rsync.add_target_host(
-                    host, reporter, destrelpath, finishedcallback=donecallback)
+                    host, reporter, destrelpath, finishedcallback=
+                    lambda host=host, root=root: donecallback(host, root))
                 reporter(repevent.HostRSyncing(host, root, remotepath))
             rsync.send(root)
 



More information about the pytest-commit mailing list