[py-svn] r63563 - in py/trunk/py/test: . plugin

hpk at codespeak.net hpk at codespeak.net
Fri Apr 3 14:18:26 CEST 2009


Author: hpk
Date: Fri Apr  3 14:18:25 2009
New Revision: 63563

Modified:
   py/trunk/py/test/event.py
   py/trunk/py/test/plugin/api.py
   py/trunk/py/test/plugin/pytest_eventlog.py
   py/trunk/py/test/plugin/pytest_execnetcleanup.py
   py/trunk/py/test/plugin/pytest_terminal.py
   py/trunk/py/test/session.py
Log:
the TestrunFinish event class bites the dust.


Modified: py/trunk/py/test/event.py
==============================================================================
--- py/trunk/py/test/event.py	(original)
+++ py/trunk/py/test/event.py	Fri Apr  3 14:18:25 2009
@@ -22,15 +22,6 @@
 # Basic Live Reporting Events 
 # ----------------------------------------------------------------------
 
-class TestrunFinish(BaseEvent):
-    def __init__(self, exitstatus=0, excinfo=None):
-        self.exitstatus = exitstatus
-        if excinfo is None:
-            self.excrepr = None
-        else:
-            self.excrepr = excinfo.getrepr()
-        self.timeend = time.time()
-
 class InternalException(BaseEvent):
     def __init__(self, excinfo=None):
         if excinfo is None:

Modified: py/trunk/py/test/plugin/api.py
==============================================================================
--- py/trunk/py/test/plugin/api.py	(original)
+++ py/trunk/py/test/plugin/api.py	Fri Apr  3 14:18:25 2009
@@ -94,7 +94,7 @@
     def pyevent__testrunstart(self):
         """ whole test run starts. """
 
-    def pyevent__testrunfinish(self, event):
+    def pyevent__testrunfinish(self, exitstatus, excrepr=None):
         """ whole test run finishes. """
 
     def pyevent__gwmanage_newgateway(self, gateway):

Modified: py/trunk/py/test/plugin/pytest_eventlog.py
==============================================================================
--- py/trunk/py/test/plugin/pytest_eventlog.py	(original)
+++ py/trunk/py/test/plugin/pytest_eventlog.py	Fri Apr  3 14:18:25 2009
@@ -38,4 +38,4 @@
     s = testdir.tmpdir.join("event.log").read()
     assert s.find("testrunstart") != -1
     assert s.find("ItemTestReport") != -1
-    assert s.find("TestrunFinish") != -1
+    assert s.find("testrunfinish") != -1

Modified: py/trunk/py/test/plugin/pytest_execnetcleanup.py
==============================================================================
--- py/trunk/py/test/plugin/pytest_execnetcleanup.py	(original)
+++ py/trunk/py/test/plugin/pytest_execnetcleanup.py	Fri Apr  3 14:18:25 2009
@@ -25,8 +25,8 @@
         self.trace("testrunstart")
         self._gateways = []
 
-    def pyevent__testrunfinish(self, event):
-        self.trace("testrunfinish", event)
+    def pyevent__testrunfinish(self, exitstatus, excrepr=None):
+        self.trace("testrunfinish", exitstatus)
         l = []
         for gw in self._gateways:
             gw.exit()

Modified: py/trunk/py/test/plugin/pytest_terminal.py
==============================================================================
--- py/trunk/py/test/plugin/pytest_terminal.py	(original)
+++ py/trunk/py/test/plugin/pytest_terminal.py	Fri Apr  3 14:18:25 2009
@@ -219,15 +219,15 @@
         for i, testarg in py.builtin.enumerate(self.config.args):
             self.write_line("test object %d: %s" %(i+1, testarg))
 
-    def pyevent__testrunfinish(self, event):
+    def pyevent__testrunfinish(self, exitstatus, excrepr=None):
         self._tw.line("")
-        if event.exitstatus in (0, 1, 2):
+        if exitstatus in (0, 1, 2):
             self.summary_failures()
             self.summary_skips()
             self.config.pytestplugins.call_each("pytest_terminal_summary", terminalreporter=self)
-        if event.excrepr is not None:
-            self.summary_final_exc(event.excrepr)
-        if event.exitstatus == 2:
+        if excrepr is not None:
+            self.summary_final_exc(excrepr)
+        if exitstatus == 2:
             self.write_sep("!", "KEYBOARD INTERRUPT")
         self.summary_deselected()
         self.summary_stats()
@@ -246,7 +246,7 @@
             self.write_line("### Watching:   %s" %(rootdir,), bold=True)
 
     #
-    # summaries for TestrunFinish 
+    # summaries for testrunfinish 
     #
 
     def summary_failures(self):
@@ -322,7 +322,7 @@
             self._failed.append(event)
         self.indent = self.indent[:-len(self.INDENT)]
 
-    def pyevent__testrunfinish(self, event):
+    def pyevent__testrunfinish(self, exitstatus, excrepr=None):
         if self._failed:
             self.out.sep("!", "collection failures")
         for event in self._failed:
@@ -378,7 +378,7 @@
         linecomp.assert_contains_lines([
                 "*test_pass_skip_fail.py .sF"
         ])
-        rep.config.bus.notify("testrunfinish", event.TestrunFinish())
+        rep.config.bus.notify("testrunfinish", exitstatus=1)
         linecomp.assert_contains_lines([
             "    def test_func():",
             ">       assert 0",
@@ -411,7 +411,7 @@
             "*test_pass_skip_fail_verbose.py:4: *test_skip*SKIP*",
             "*test_pass_skip_fail_verbose.py:6: *test_func*FAIL*",
         ])
-        rep.config.bus.notify("testrunfinish", event.TestrunFinish())
+        rep.config.bus.notify("testrunfinish", exitstatus=1)
         linecomp.assert_contains_lines([
             "    def test_func():",
             ">       assert 0",
@@ -428,7 +428,7 @@
         linecomp.assert_contains_lines([
             "*test_collect_fail.py F*"
         ])
-        rep.config.bus.notify("testrunfinish", event.TestrunFinish())
+        rep.config.bus.notify("testrunfinish", exitstatus=1)
         linecomp.assert_contains_lines([
             ">   import xyz",
             "E   ImportError: No module named xyz"
@@ -522,7 +522,7 @@
             rep.config.bus.notify("testrunstart")
             for item in testdir.genitems([modcol]):
                 rep.config.bus.notify("itemtestreport", basic_run_report(item))
-            rep.config.bus.notify("testrunfinish", event.TestrunFinish())
+            rep.config.bus.notify("testrunfinish", exitstatus=1)
             s = linecomp.stringio.getvalue()
             if tbopt == "long":
                 print s
@@ -577,7 +577,7 @@
         s = linecomp.stringio.getvalue()
         if not verbose:
             assert s.find("_keyboard_interrupt.py Fs") != -1
-        bus.notify("testrunfinish", event.TestrunFinish(exitstatus=2, excinfo=excinfo))
+        bus.notify("testrunfinish", exitstatus=2, excrepr=excinfo.getrepr())
         text = linecomp.stringio.getvalue()
         linecomp.assert_contains_lines([
             "    def test_foobar():",

Modified: py/trunk/py/test/session.py
==============================================================================
--- py/trunk/py/test/session.py	(original)
+++ py/trunk/py/test/session.py	Fri Apr  3 14:18:25 2009
@@ -91,7 +91,8 @@
     def sessionfinishes(self, exitstatus=0, excinfo=None):
         """ teardown any resources after a test run. """ 
         self.bus.notify("testrunfinish", 
-                        event.TestrunFinish(exitstatus=exitstatus, excinfo=excinfo))
+                        exitstatus=exitstatus, 
+                        excrepr=excinfo and excinfo.getrepr() or None)
 
     def getinitialitems(self, colitems):
         if colitems is None:



More information about the pytest-commit mailing list