[py-svn] r45867 - in py/branch/session-cleanups/py/test: rsession rsession/testing testing

fijal at codespeak.net fijal at codespeak.net
Sun Aug 19 16:23:52 CEST 2007


Author: fijal
Date: Sun Aug 19 16:23:51 2007
New Revision: 45867

Modified:
   py/branch/session-cleanups/py/test/rsession/rsession.py
   py/branch/session-cleanups/py/test/rsession/testing/test_rest.py
   py/branch/session-cleanups/py/test/testing/test_reporter.py
Log:
Some simplification and avoiding some test skips.


Modified: py/branch/session-cleanups/py/test/rsession/rsession.py
==============================================================================
--- py/branch/session-cleanups/py/test/rsession/rsession.py	(original)
+++ py/branch/session-cleanups/py/test/rsession/rsession.py	Sun Aug 19 16:23:51 2007
@@ -31,7 +31,7 @@
             option.boxed = True
         super(AbstractSession, self).fixoptions()
 
-    def init_reporter(self, reporter, hosts, reporter_class, arg=""):
+    def init_reporter(self, reporter, hosts, reporter_class):
         """ This initialises so called `reporter` class, which will
         handle all event presenting to user. Does not get called
         if main received custom reporter
@@ -46,10 +46,7 @@
             if restflag:
                 from py.__.test.rsession.rest import RestReporter
                 reporter_class = RestReporter
-            if arg:
-                reporter_instance = reporter_class(self.config, hosts)
-            else:
-                reporter_instance = reporter_class(self.config, hosts)
+            reporter_instance = reporter_class(self.config, hosts)
             reporter = reporter_instance.report
         
         return reporter
@@ -97,8 +94,6 @@
     
     def main(self, reporter=None):
         """ main loop for running tests. """
-        args = self.config.args
-
         hm = HostManager(self.config)
         reporter = self.init_reporter(reporter,
             hm.hosts, RemoteReporter)
@@ -144,15 +139,13 @@
     """
     def main(self, reporter=None, runner=None):
         # check out if used options makes any sense
-        args = self.config.args  
-       
         hm = HostManager(self.config, hosts=[HostInfo('localhost')])
         hosts = hm.hosts
         if not self.config.option.nomagic:
             py.magic.invoke(assertion=1)
 
         reporter = self.init_reporter(reporter, 
-            hosts, LocalReporter, args[0])
+            hosts, LocalReporter)
         reporter, checkfun = self.wrap_reporter(reporter)
         
         reporter(repevent.TestStarted(hosts, self.config.topdir, []))

Modified: py/branch/session-cleanups/py/test/rsession/testing/test_rest.py
==============================================================================
--- py/branch/session-cleanups/py/test/rsession/testing/test_rest.py	(original)
+++ py/branch/session-cleanups/py/test/rsession/testing/test_rest.py	Sun Aug 19 16:23:51 2007
@@ -336,18 +336,15 @@
         py.test.skip("Not implemented")
     
     def test_report_received_item_outcome(self):
-        py.test.skip("Relying on exact output matching")
         val = self.report_received_item_outcome()
-        expected = """\
-* localhost\: **FAILED** `traceback0`_\n  py/test/rsession/testing/test\_slave.py/funcpass
+        expected_list = [
+            "**FAILED**",
+            "**SKIPPED**",
+            "**PASSED**",
+            "* localhost\:",
+            "`traceback0`_ test\_one.py/funcpass",
+            "test\_one.py/funcpass"]
+        for expected in expected_list:
+            assert val.find(expected) != -1
 
-* localhost\: **SKIPPED** py/test/rsession/testing/test\_slave.py/funcpass
-
-* localhost\: **FAILED** `traceback1`_\n  py/test/rsession/testing/test\_slave.py/funcpass
-
-* localhost\: **PASSED** py/test/rsession/testing/test\_slave.py/funcpass
-
-"""
-        print val
-        assert val == expected
 

Modified: py/branch/session-cleanups/py/test/testing/test_reporter.py
==============================================================================
--- py/branch/session-cleanups/py/test/testing/test_reporter.py	(original)
+++ py/branch/session-cleanups/py/test/testing/test_reporter.py	Sun Aug 19 16:23:51 2007
@@ -150,6 +150,8 @@
         cap = py.io.StdCaptureFD()
         config = py.test.config._reparse([str(tmpdir)])
         hosts = [HostInfo(i) for i in ["host1", "host2", "host3"]]
+        for host in hosts:
+            host.gw_remotepath = ''
         r = self.reporter(config, hosts)
         r.report(repevent.TestStarted(hosts, config.topdir, ["a", "b", "c"]))
         for host in hosts:
@@ -191,7 +193,6 @@
     reporter = RemoteReporter
 
     def test_still_to_go(self):
-        py.test.skip("XXX fix it, there is shadowed internal reporting problem")
         self._test_still_to_go()
 
     def test_report_received_item_outcome(self):


More information about the py-svn mailing list