[py-svn] r56664 - py/branch/event/py/test2

hpk at codespeak.net hpk at codespeak.net
Sat Jul 19 12:32:02 CEST 2008


Author: hpk
Date: Sat Jul 19 12:32:02 2008
New Revision: 56664

Modified:
   py/branch/event/py/test2/collect.py
   py/branch/event/py/test2/executor.py
   py/branch/event/py/test2/item.py
Log:
review, add some comments, shift methods


Modified: py/branch/event/py/test2/collect.py
==============================================================================
--- py/branch/event/py/test2/collect.py	(original)
+++ py/branch/event/py/test2/collect.py	Sat Jul 19 12:32:02 2008
@@ -27,7 +27,7 @@
 import py
 from py.__.test2 import present
 
-sysex = (KeyboardInterrupt, SystemExit)
+sysex = (KeyboardInterrupt, SystemExit) # XXX GeneratorExit?
 
 def configproperty(name):
     def fget(self):
@@ -38,8 +38,7 @@
 class Node(object): 
     """ base class for Nodes in the collection tree.  
         Nodes with Children are "Collectors" and 
-        leaves (without children) are runnable 
-        Test Items.  
+        leaves are runnable Test Items.  
     """
     def __init__(self, name, parent=None, config=None):
         self.name = name 
@@ -52,16 +51,18 @@
     def __repr__(self): 
         return "<%s %r>" %(self.__class__.__name__, self.name) 
 
+    # methods for ordering nodes
+
     def __eq__(self, other): 
         if not isinstance(other, Node):
             return False 
         return self.name == other.name and self.parent == other.parent 
+
+    def __ne__(self, other):
+        return not self == other
     
     def __hash__(self):
         return hash((self.name, self.parent))
-    
-    def __ne__(self, other):
-        return not self == other
 
     def __cmp__(self, other): 
         if not isinstance(other, Node):
@@ -69,16 +70,12 @@
         s1 = self._getsortvalue()
         s2 = other._getsortvalue()
         return cmp(s1, s2) 
-  
-    def multijoin(self, namelist): 
-        """ return a list of colitems for the given namelist. """ 
-        return [self.join(name) for name in namelist]
-
+ 
     def setup(self): 
-        pass 
+        pass
 
     def teardown(self): 
-        pass 
+        pass
 
     def listchain(self): 
         """ return list of all parent collectors up to self. """ 
@@ -189,6 +186,10 @@
         py.std.warnings.warn("deprecated: use listdir()", category=DeprecationWarning)
         return self.listdir()
 
+    def multijoin(self, namelist): 
+        """ return a list of colitems for the given namelist. """ 
+        return [self.join(name) for name in namelist]
+
     def listdir(self):
         """ returns a list of names available from this collector.
             You can return an empty list.  Callers of this method

Modified: py/branch/event/py/test2/executor.py
==============================================================================
--- py/branch/event/py/test2/executor.py	(original)
+++ py/branch/event/py/test2/executor.py	Sat Jul 19 12:32:02 2008
@@ -4,8 +4,7 @@
 import py, os, sys
 
 from py.__.test2 import repevent
-from py.__.test2.outcome import Skipped, Failed
-from py.__.test2 import repevent, present
+from py.__.test2.outcome import Skipped
 import py.__.test2.custompdb
 
 sysex = (KeyboardInterrupt, SystemExit)

Modified: py/branch/event/py/test2/item.py
==============================================================================
--- py/branch/event/py/test2/item.py	(original)
+++ py/branch/event/py/test2/item.py	Sat Jul 19 12:32:02 2008
@@ -45,6 +45,9 @@
         xxx 
 
     def runtest(self):
+        """ Return an ItemTestReport event which has all the
+            information about running the underlying test item. 
+        """ 
         from py.__.test2.executor import getexecutor
         executor = getexecutor(self, self._config)
         return executor.execute()



More information about the pytest-commit mailing list