[py-svn] r7818 - in py/dist/py/test: . report/text

hpk at codespeak.net hpk at codespeak.net
Sat Dec 11 18:28:27 CET 2004


Author: hpk
Date: Sat Dec 11 18:28:27 2004
New Revision: 7818

Modified:
   py/dist/py/test/drive.py
   py/dist/py/test/item.py
   py/dist/py/test/report/text/reporter.py
   py/dist/py/test/report/text/summary.py
Log:
small cleanup and slightly improved documentation 

with --pdb you know get to see the usual failure 
output first (instead of directly thrown on the
pdb-cmdline)



Modified: py/dist/py/test/drive.py
==============================================================================
--- py/dist/py/test/drive.py	(original)
+++ py/dist/py/test/drive.py	Sat Dec 11 18:28:27 2004
@@ -86,13 +86,14 @@
                 close()
 
     def runitem(self, item):
-        self.reporter.startitem(item)
         if not self.option.collectonly: 
+            self.reporter.startitem(item)
             try:
                 res = item.run(self) or item.Passed()
             except item.Outcome, res:
                 res.excinfo = py.std.sys.exc_info()
             except (KeyboardInterrupt, SystemExit):
+                self.reporter.enditem(res)
                 raise
             except:
                 res = item.Failed(excinfo=py.std.sys.exc_info())

Modified: py/dist/py/test/item.py
==============================================================================
--- py/dist/py/test/item.py	(original)
+++ py/dist/py/test/item.py	Sat Dec 11 18:28:27 2004
@@ -19,9 +19,9 @@
             (pointed to by extpy). Tear down any previously 
             setup objects which are not directly needed. 
         """ 
-        # setupstack contains (extpy, obj)'s of already setup objects 
-        # strict ordering is maintained, i.e. each extpy in
-        # the stack is "relto" the previous extpy. 
+        # _setupstack contains (extpy, obj) tuples of already setup 
+        # objects.  Strict ordering is maintained, i.e. each extpy in
+        # the stack is "relto" its previous extpy. 
         stack = self._setupstack 
         while stack and not extpy.relto(stack[-1][0]): 
             self._teardownone(stack.pop()[1])
@@ -111,7 +111,7 @@
         self.call = call 
   
     def execute(self, target, *args): 
-        print "calling %r%r" %(self.call, args) 
+        #print "calling %r%r" %(self.call, args) 
         return self.call(*args)
 
     def reprcall(self): 

Modified: py/dist/py/test/report/text/reporter.py
==============================================================================
--- py/dist/py/test/report/text/reporter.py	(original)
+++ py/dist/py/test/report/text/reporter.py	Sat Dec 11 18:28:27 2004
@@ -29,7 +29,7 @@
             f = py.std.sys.stdout 
         self.out = getout(f) 
         self._started = {}
-        self.summary = self.Summary() 
+        self.summary = self.Summary(self.out) 
         self.summary.option = self.option = py.test.config.option 
 
     def start(self):
@@ -47,7 +47,7 @@
         if not self.option.nomagic:
             py.magic.revoke(assertion=1) 
         self.summary.endtime = now() 
-        self.summary.render(self.out) 
+        self.summary.render() 
 
     def open(self, collector):
         if self.option.collectonly:
@@ -145,6 +145,7 @@
         if self.option.usepdb:
             if (issubclass(restype, Collector.Error) or
                 issubclass(restype, Item.Failed)):
+                self.summary.repr_failure(result)
                 import pdb
                 self.out.rewrite(
                     '\n%s: %s\n'

Modified: py/dist/py/test/report/text/summary.py
==============================================================================
--- py/dist/py/test/report/text/summary.py	(original)
+++ py/dist/py/test/report/text/summary.py	Sat Dec 11 18:28:27 2004
@@ -4,8 +4,8 @@
 from py.__impl__.magic import exprinfo, assertion
 
 class Summary(object):
-    def __init__(self): 
-        pass 
+    def __init__(self, out): 
+        self.out = out 
 
     def append(self, restype, testresult):
         self.getlist(restype).append(testresult)
@@ -37,8 +37,7 @@
         for error in self.getlist(py.test.collect.Error): 
             self.repr_collect_error(error) 
 
-    def render(self, out):
-        self.out = out 
+    def render(self):
         self.out.write('\n')
         self.skippedreasons()
         self.failures()



More information about the pytest-commit mailing list