[py-svn] r38021 - in py/trunk/py/test/rsession: . testing

fijal at codespeak.net fijal at codespeak.net
Tue Feb 6 19:44:19 CET 2007


Author: fijal
Date: Tue Feb  6 19:44:16 2007
New Revision: 38021

Modified:
   py/trunk/py/test/rsession/hostmanage.py
   py/trunk/py/test/rsession/repevent.py
   py/trunk/py/test/rsession/reporter.py
   py/trunk/py/test/rsession/rsession.py
   py/trunk/py/test/rsession/testing/test_reporter.py
   py/trunk/py/test/rsession/testing/test_rest.py
Log:
Simple refactoring to be a bit more verbose when starting.


Modified: py/trunk/py/test/rsession/hostmanage.py
==============================================================================
--- py/trunk/py/test/rsession/hostmanage.py	(original)
+++ py/trunk/py/test/rsession/hostmanage.py	Tue Feb  6 19:44:16 2007
@@ -115,6 +115,10 @@
             hosts = self.config.getvalue("dist_hosts")
             hosts = [HostInfo(x) for x in hosts]
         self.hosts = hosts
+        roots = self.config.getvalue_pathlist("dist_rsync_roots")
+        if roots is None:
+            roots = [self.config.topdir]
+        self.roots = roots
 
     def prepare_gateways(self):
         dist_remotepython = self.config.getvalue("dist_remotepython")
@@ -124,14 +128,11 @@
 
     def init_rsync(self, reporter):
         # send each rsync root
-        roots = self.config.getvalue_pathlist("dist_rsync_roots")
         ignores = self.config.getvalue_pathlist("dist_rsync_ignore")
-        if roots is None:
-            roots = [self.config.topdir]
         self.prepare_gateways()
         for host in self.hosts:
-            reporter(repevent.HostRSyncRoots(host, roots))
-        for root in roots:
+            reporter(repevent.HostRSyncRoots(host, self.roots))
+        for root in self.roots:
             rsync = HostRSync(ignores=ignores)
             destrelpath = root.relto(self.config.topdir)
             for host in self.hosts:

Modified: py/trunk/py/test/rsession/repevent.py
==============================================================================
--- py/trunk/py/test/rsession/repevent.py	(original)
+++ py/trunk/py/test/rsession/repevent.py	Tue Feb  6 19:44:16 2007
@@ -88,8 +88,10 @@
         self.root = root
 
 class TestStarted(ReportEvent):
-    def __init__(self, hosts):
+    def __init__(self, hosts, topdir, roots):
         self.hosts = hosts
+        self.topdir = topdir
+        self.roots = roots
         self.timestart = time.time()
 
 class TestFinished(ReportEvent):

Modified: py/trunk/py/test/rsession/reporter.py
==============================================================================
--- py/trunk/py/test/rsession/reporter.py	(original)
+++ py/trunk/py/test/rsession/reporter.py	Tue Feb  6 19:44:16 2007
@@ -82,6 +82,11 @@
         self.hosts_to_rsync = len(item.hosts)
         self.out.sep("=", txt)
         self.timestart = item.timestart
+        self.out.write("Root directory: %s\n" % item.topdir)
+        roots = [str(i.relto(item.topdir)) for i in item.roots]
+        self.out.write("To rsync:\n")
+        for root in roots:
+            self.out.write("    => %s\n" % root)
 
     def report_RsyncFinished(self, item):
         self.timersync = item.time

Modified: py/trunk/py/test/rsession/rsession.py
==============================================================================
--- py/trunk/py/test/rsession/rsession.py	(original)
+++ py/trunk/py/test/rsession/rsession.py	Tue Feb  6 19:44:16 2007
@@ -132,7 +132,8 @@
             hm.hosts, RemoteReporter)
         reporter, checkfun = self.wrap_reporter(reporter)
 
-        reporter(repevent.TestStarted(hm.hosts))
+        reporter(repevent.TestStarted(hm.hosts, self.config.topdir,
+                                      hm.roots))
 
         try:
             nodes = hm.setup_hosts(reporter)
@@ -186,7 +187,7 @@
             hosts, LocalReporter, args[0])
         reporter, checkfun = self.wrap_reporter(reporter)
         
-        reporter(repevent.TestStarted(hosts))
+        reporter(repevent.TestStarted(hosts, self.config.topdir, []))
         colitems = self.config.getcolitems()
         reporter(repevent.RsyncFinished())
 

Modified: py/trunk/py/test/rsession/testing/test_reporter.py
==============================================================================
--- py/trunk/py/test/rsession/testing/test_reporter.py	(original)
+++ py/trunk/py/test/rsession/testing/test_reporter.py	Tue Feb  6 19:44:16 2007
@@ -142,7 +142,7 @@
             rootcol = py.test.collect.Directory(tmpdir)
             host = HostInfo('localhost')
             r = self.reporter(config, [host])
-            r.report(repevent.TestStarted([host]))
+            r.report(repevent.TestStarted([host], config.topdir, ["a"]))
             r.report(repevent.RsyncFinished())
             list(rootcol._tryiter(reporterror=lambda x : AbstractSession.reporterror(r.report, x)))
             r.report(repevent.TestFinished())
@@ -160,7 +160,7 @@
         config = py.test.config._reparse([str(tmpdir)])
         hosts = [HostInfo(i) for i in ["host1", "host2", "host3"]]
         r = self.reporter(config, hosts)
-        r.report(repevent.TestStarted(hosts))
+        r.report(repevent.TestStarted(hosts, config.topdir, ["a", "b", "c"]))
         for host in hosts:
             r.report(repevent.HostRSyncRoots(host, ["a", "b", "c"]))
         for host in hosts:

Modified: py/trunk/py/test/rsession/testing/test_rest.py
==============================================================================
--- py/trunk/py/test/rsession/testing/test_rest.py	(original)
+++ py/trunk/py/test/rsession/testing/test_rest.py	Tue Feb  6 19:44:16 2007
@@ -66,8 +66,9 @@
         assert stdout.getvalue() == '::\n\n   localhost: READY\n\n'
 
     def test_report_TestStarted(self):
-        event = repevent.TestStarted(hosts=[HostInfo('localhost'),
-                                          HostInfo('foo.com')])
+        event = repevent.TestStarted([HostInfo('localhost'),
+                                          HostInfo('foo.com')],
+                                     "aa", ["a", "b"])
         reporter.report(event)
         assert stdout.getvalue() == """\
 ===========================================


More information about the py-svn mailing list