[py-svn] r51167 - in py/branch/event/py/test2: . rsession rsession/testing testing

hpk at codespeak.net hpk at codespeak.net
Fri Feb 1 11:20:19 CET 2008


Author: hpk
Date: Fri Feb  1 11:20:17 2008
New Revision: 51167

Modified:
   py/branch/event/py/test2/collect.py
   py/branch/event/py/test2/collectonly.py
   py/branch/event/py/test2/item.py
   py/branch/event/py/test2/outcome.py
   py/branch/event/py/test2/reporter.py
   py/branch/event/py/test2/rsession/hostmanage.py
   py/branch/event/py/test2/rsession/local.py
   py/branch/event/py/test2/rsession/master.py
   py/branch/event/py/test2/rsession/rest.py
   py/branch/event/py/test2/rsession/rsession.py
   py/branch/event/py/test2/rsession/slave.py
   py/branch/event/py/test2/rsession/testing/test_rest.py
   py/branch/event/py/test2/rsession/web.py
   py/branch/event/py/test2/rsession/webjs.py
   py/branch/event/py/test2/session.py
   py/branch/event/py/test2/testing/test_itemgen.py
   py/branch/event/py/test2/testing/test_session2.py
Log:
* getting rid of many unused imports 
* more event naming cleanup 


Modified: py/branch/event/py/test2/collect.py
==============================================================================
--- py/branch/event/py/test2/collect.py	(original)
+++ py/branch/event/py/test2/collect.py	Fri Feb  1 11:20:17 2008
@@ -25,7 +25,6 @@
 """ 
 from __future__ import generators 
 import py
-from py.__.test2.outcome import Skipped
 
 def configproperty(name):
     def fget(self):

Modified: py/branch/event/py/test2/collectonly.py
==============================================================================
--- py/branch/event/py/test2/collectonly.py	(original)
+++ py/branch/event/py/test2/collectonly.py	Fri Feb  1 11:20:17 2008
@@ -21,12 +21,11 @@
     def report_ItemFinish(self, event):
         self.indent -= 2
 
-    def report_FailedTryiter(self, event):
+    def report_CollectionFailed(self, event):
         self.out.line(" " * self.indent + "- FAILED TO LOAD MODULE -")
 
-    def report_SkippedTryiter(self, event):
+    def report_DeselectedTest(self, event):
         self.out.line(" " * self.indent + "- skipped -")
 
     def summary(self):
         self.out.sep("=", "Total time: %.1f" % (self.timeend - self.timestart))
-

Modified: py/branch/event/py/test2/item.py
==============================================================================
--- py/branch/event/py/test2/item.py	(original)
+++ py/branch/event/py/test2/item.py	Fri Feb  1 11:20:17 2008
@@ -1,7 +1,7 @@
 import py
 
 from inspect import isclass, ismodule
-from py.__.test2.outcome import Skipped, Failed, Passed
+from py.__.test2 import outcome 
 from py.__.test2.collect import FunctionMixin
 
 _dummy = object()
@@ -72,10 +72,10 @@
 def skip(msg=""):
     """ skip with the given Message. """
     __tracebackhide__ = True
-    raise Skipped(msg=msg) 
+    raise outcome.Skipped(msg=msg) 
 
 def fail(msg="unknown failure"):
     """ fail with the given Message. """
     __tracebackhide__ = True
-    raise Failed(msg=msg) 
+    raise outcome.Failed(msg=msg) 
 

Modified: py/branch/event/py/test2/outcome.py
==============================================================================
--- py/branch/event/py/test2/outcome.py	(original)
+++ py/branch/event/py/test2/outcome.py	Fri Feb  1 11:20:17 2008
@@ -3,7 +3,7 @@
 serialization of outcomes
 """
 
-import py, sys
+import py
 
 class Outcome: 
     def __init__(self, msg=None, excinfo=None): 

Modified: py/branch/event/py/test2/reporter.py
==============================================================================
--- py/branch/event/py/test2/reporter.py	(original)
+++ py/branch/event/py/test2/reporter.py	Fri Feb  1 11:20:17 2008
@@ -231,7 +231,7 @@
                 outcome = event.outcome
                 text = outcome.skipped.value
                 itemname = repr(outcome.skipped.traceback[-2]).split("\n")[0]
-            elif isinstance(event, repevent.SkippedTryiter):
+            elif isinstance(event, repevent.DeselectedTest):
                 text = str(event.excinfo.value)
                 itemname = "/".join(colitem.listnames())
             if text not in texts:
@@ -277,7 +277,7 @@
             (total, skipped_str, failed_str, self.timeend - self.timestart,
              self.timersync - self.timestart))
     
-    def report_SkippedTryiter(self, event):
+    def report_DeselectedTest(self, event):
         #event.outcome.excinfo.source = 
         self.skipped_tests_outcome.append(event)
     
@@ -337,7 +337,7 @@
         # argh! bad hack, need to fix it
         self.failed[self.hosts[0]] += 1
     
-    def report_SkippedTryiter(self, event):
+    def report_DeselectedTest(self, event):
         self.out.line("Skipped (%s) %s\n" % (str(event.excinfo.value), "/".
             join(event.item.listnames())))
 
@@ -376,7 +376,7 @@
         self.out.sep("=", " %d test run%s%s in %.2fs" % 
             (total, skipped_str, failed_str, self.timeend - self.timestart))
 
-    def report_SkippedTryiter(self, event):
+    def report_DeselectedTest(self, event):
         #self.show_item(event.item, False)
         if isinstance(event.item, py.test2.collect.Module):
             self.out.write("- skipped (%s)" % event.excinfo.value)

Modified: py/branch/event/py/test2/rsession/hostmanage.py
==============================================================================
--- py/branch/event/py/test2/rsession/hostmanage.py	(original)
+++ py/branch/event/py/test2/rsession/hostmanage.py	Fri Feb  1 11:20:17 2008
@@ -1,10 +1,7 @@
-import sys, os
 import py
-import time
-import thread, threading 
+import sys, os
 from py.__.test2.rsession.master import MasterNode
 from py.__.test2.rsession.slave import setup_slave
-
 from py.__.test2 import repevent
 
 class HostInfo(object):

Modified: py/branch/event/py/test2/rsession/local.py
==============================================================================
--- py/branch/event/py/test2/rsession/local.py	(original)
+++ py/branch/event/py/test2/rsession/local.py	Fri Feb  1 11:20:17 2008
@@ -1,4 +1,3 @@
-
 """ local-only operations
 """
 

Modified: py/branch/event/py/test2/rsession/master.py
==============================================================================
--- py/branch/event/py/test2/rsession/master.py	(original)
+++ py/branch/event/py/test2/rsession/master.py	Fri Feb  1 11:20:17 2008
@@ -4,8 +4,6 @@
 import py
 from py.__.test2.outcome import ReprOutcome
 from py.__.test2 import repevent
-from py.__.test2.outcome import Skipped
-from py.builtin import GeneratorExit
 
 class MasterNode(object):
     def __init__(self, channel, notify): 

Modified: py/branch/event/py/test2/rsession/rest.py
==============================================================================
--- py/branch/event/py/test2/rsession/rest.py	(original)
+++ py/branch/event/py/test2/rsession/rest.py	Fri Feb  1 11:20:17 2008
@@ -132,7 +132,7 @@
                 outcome = event.outcome
                 text = outcome.skipped
                 itemname = self.get_item_name(event, colitem)
-            elif isinstance(event, repevent.SkippedTryiter):
+            elif isinstance(event, repevent.DeselectedTest):
                 text = str(event.excinfo.value)
                 itemname = "/".join(colitem.listnames())
             if text not in texts:

Modified: py/branch/event/py/test2/rsession/rsession.py
==============================================================================
--- py/branch/event/py/test2/rsession/rsession.py	(original)
+++ py/branch/event/py/test2/rsession/rsession.py	Fri Feb  1 11:20:17 2008
@@ -10,11 +10,8 @@
 
 from py.__.test2 import repevent
 from py.__.test2.rsession.master import dispatch_loop
-from py.__.test2.rsession.hostmanage import HostInfo, HostManager
-from py.__.test2.rsession.local import local_loop, plain_runner, apigen_runner,\
-    box_runner
+from py.__.test2.rsession.hostmanage import HostManager
 from py.__.test2.session import AbstractSession, itemgen
-from py.__.test2.outcome import Skipped, Failed
     
 class RSession(AbstractSession):
     """ Remote version of session

Modified: py/branch/event/py/test2/rsession/slave.py
==============================================================================
--- py/branch/event/py/test2/rsession/slave.py	(original)
+++ py/branch/event/py/test2/rsession/slave.py	Fri Feb  1 11:20:17 2008
@@ -6,7 +6,6 @@
 from py.__.test2.executor import RunExecutor, BoxExecutor, AsyncExecutor
 from py.__.test2.outcome import SerializableOutcome
 from py.__.test2.outcome import Skipped
-import thread
 import os
 
 class SlaveNode(object):

Modified: py/branch/event/py/test2/rsession/testing/test_rest.py
==============================================================================
--- py/branch/event/py/test2/rsession/testing/test_rest.py	(original)
+++ py/branch/event/py/test2/rsession/testing/test_rest.py	Fri Feb  1 11:20:17 2008
@@ -178,7 +178,7 @@
         class FakeOutcome(Container, repevent.ReceivedItemOutcome):
             pass
 
-        class FakeTryiter(Container, repevent.SkippedTryiter):
+        class FakeTryiter(Container, repevent.DeselectedTest):
             pass
         
         reporter.skips()

Modified: py/branch/event/py/test2/rsession/web.py
==============================================================================
--- py/branch/event/py/test2/rsession/web.py	(original)
+++ py/branch/event/py/test2/rsession/web.py	Fri Feb  1 11:20:17 2008
@@ -250,7 +250,7 @@
             args = {'hostname' : event.host.hostname, 'hostkey' : event.host.hostid}
         elif isinstance(event, repevent.FailedTryiter):
             args = add_item(event)
-        elif isinstance(event, repevent.SkippedTryiter):
+        elif isinstance(event, repevent.DeselectedTest):
             args = add_item(event)
             args['reason'] = str(event.excinfo.value)
         else:

Modified: py/branch/event/py/test2/rsession/webjs.py
==============================================================================
--- py/branch/event/py/test2/rsession/webjs.py	(original)
+++ py/branch/event/py/test2/rsession/webjs.py	Fri Feb  1 11:20:17 2008
@@ -222,7 +222,7 @@
         module_part.appendChild(tr)
         item_name = msg['fullitemname']
         exported_methods.show_fail(item_name, fail_come_back)
-    elif msg['type'] == 'SkippedTryiter':
+    elif msg['type'] == 'DeselectedTest':
         module_part = get_elem(msg['fullitemname'])
         if not module_part:
             glob.pending.append(msg)

Modified: py/branch/event/py/test2/session.py
==============================================================================
--- py/branch/event/py/test2/session.py	(original)
+++ py/branch/event/py/test2/session.py	Fri Feb  1 11:20:17 2008
@@ -1,20 +1,15 @@
+""" basic test session implementation. 
+
+* drives collection of tests 
+* triggers executions of tests   
+* produces events used by reporting 
+"""
+
 import py
-import sys
-from py.__.test2.outcome import Outcome, Failed, Passed, Skipped
 from py.__.test2 import repevent
-from py.__.test2.outcome import SerializableOutcome, ReprOutcome
-from py.__.test2.reporter import LocalReporter
+from py.__.test2.outcome import ReprOutcome
 from py.__.test2.executor import RunExecutor, BoxExecutor
 
-""" The session implementation - reporter version:
-
-* itemgen is responsible for iterating and telling reporter
-  about skipped and failed iterations (this is for collectors only),
-  this should be probably moved to session (for uniformity)
-* session gets items which needs to be executed one after another
-  and tells reporter about that
-"""
-
 GeneratorExit = py.builtin.GeneratorExit 
 
 def itemgen(session, colitems, keywordexpr=None):
@@ -73,8 +68,6 @@
         A Session gets test Items from Collectors, executes the
         Items and sends the Outcome to the Reporter.
     """
-    reporterclass = LocalReporter
-    
     def shouldclose(self): 
         return False
 
@@ -116,7 +109,6 @@
         finally:
             self.footer(colitems)
         return failures 
-        return self.getitemoutcomepairs(Failed)
 
     def run(self, item):
         if not self.config.option.boxed:

Modified: py/branch/event/py/test2/testing/test_itemgen.py
==============================================================================
--- py/branch/event/py/test2/testing/test_itemgen.py	(original)
+++ py/branch/event/py/test2/testing/test_itemgen.py	Fri Feb  1 11:20:17 2008
@@ -31,7 +31,7 @@
         colitems = [py.test2.collect.Directory(self.tmp)]
         gen = itemgen(None, colitems, l.append)
         items = [i for i in gen]
-        assert len([i for i in l if isinstance(i, repevent.SkippedTryiter)]) == 1
+        assert len([i for i in l if isinstance(i, repevent.DeselectedTest)]) == 1
         assert len([i for i in l if isinstance(i, repevent.FailedTryiter)]) == 1
         assert len(items) == 3
         assert items[0].name == 'test_one'

Modified: py/branch/event/py/test2/testing/test_session2.py
==============================================================================
--- py/branch/event/py/test2/testing/test_session2.py	(original)
+++ py/branch/event/py/test2/testing/test_session2.py	Fri Feb  1 11:20:17 2008
@@ -241,7 +241,7 @@
                         if isinstance(x, repevent.FailedTryiter)]
         assert len(failedtryiter) == 1
         skippedtryiter = [x for x in allevents 
-                        if isinstance(x, repevent.SkippedTryiter)]
+                        if isinstance(x, repevent.DeselectedTest)]
         assert len(skippedtryiter) == 1
         
 



More information about the pytest-commit mailing list