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

hpk at codespeak.net hpk at codespeak.net
Sun Jul 20 16:54:16 CEST 2008


Author: hpk
Date: Sun Jul 20 16:54:15 2008
New Revision: 56686

Modified:
   py/branch/event/py/test2/item.py
   py/branch/event/py/test2/present.py
   py/branch/event/py/test2/runner.py
   py/branch/event/py/test2/testing/test_runner.py
Log:
internal rename


Modified: py/branch/event/py/test2/item.py
==============================================================================
--- py/branch/event/py/test2/item.py	(original)
+++ py/branch/event/py/test2/item.py	Sun Jul 20 16:54:15 2008
@@ -60,19 +60,14 @@
         if callobj is not _dummy: 
             self._obj = callobj 
 
-    def run(self):
-        """ setup and execute the underlying test function. """
-        self._config._setupstate.prepare(self) 
-        self.execute(self.obj, *self._args)
-
-    def execute(self, target, *args):
+    def execute(self):
         """ execute the given test function. """
-        target(*args)
+        self.obj(*self._args)
 
-    def repr_run(self, runinfo):
+    def repr_run(self, runnerinfo):
         """ return a textual representation of run info. """ 
         p = present.PythonFunctionPresenter(self._config, self) 
-        p.repr_run(runinfo)
+        p.repr_run(runnerinfo)
         return p.out.stringio.getvalue()
 
     def repr_path(self):

Modified: py/branch/event/py/test2/present.py
==============================================================================
--- py/branch/event/py/test2/present.py	(original)
+++ py/branch/event/py/test2/present.py	Sun Jul 20 16:54:15 2008
@@ -1,12 +1,9 @@
-
-""" XXX this file serves as a reminder about some remaining 
-    reporting issues that are not handled by the new py/code/tbpresenter
+""" 
+    Some specifics about reporting Python tracebacks in py.test
 """
 
 import py
-
 from py.__.code.tbpresent import TBPresenter
-
 from py.__.test2.rep.reporter import getmodpath
 
 class PythonFunctionPresenter(TBPresenter):
@@ -32,13 +29,13 @@
                 self.out.line(line)
 
 
-    def repr_run(self, runinfo):
-        excinfo = runinfo.excinfo
+    def repr_run(self, runnerinfo):
+        excinfo = runnerinfo.excinfo
         self.header()
         if excinfo:
             excinfo.traceback = self._item.prunetraceback(excinfo.traceback)
             self.repr_tb(excinfo)
-        for name, value in runinfo.outerr:
+        for name, value in runnerinfo.outerr:
             if value:
                 self.out.sep("- ", "%s, len=%d" %(name, len(value)))
                 self.out.line(value.rstrip())

Modified: py/branch/event/py/test2/runner.py
==============================================================================
--- py/branch/event/py/test2/runner.py	(original)
+++ py/branch/event/py/test2/runner.py	Sun Jul 20 16:54:15 2008
@@ -9,7 +9,7 @@
 from py.__.test.outcome import Skipped as Skipped2
 import py.__.test2.custompdb
 
-class RunInfo:
+class RunnerInfo:
     """ info on test runs. """
     def __init__(self, excinfo, outerr):
         self.excinfo = excinfo
@@ -22,7 +22,8 @@
     excinfo = None
     try:
         try:
-            item.run()
+            config._setupstate.prepare(item) 
+            item.execute()
         finally:
             out, err = capture.reset()
             outerr = (("recorded stdout", out), ("recorded stderr", err))
@@ -43,8 +44,8 @@
             outcome = "failed"
     else:
         outcome = "passed"
-    runinfo = RunInfo(excinfo, outerr)
-    repr_run = item.repr_run(runinfo)
+    runnerinfo = RunnerInfo(excinfo, outerr)
+    repr_run = item.repr_run(runnerinfo)
     repr_path = item.repr_path()
     return repevent.ItemTestReport(trail, outcome, repr_run, repr_path)
 

Modified: py/branch/event/py/test2/testing/test_runner.py
==============================================================================
--- py/branch/event/py/test2/testing/test_runner.py	(original)
+++ py/branch/event/py/test2/testing/test_runner.py	Sun Jul 20 16:54:15 2008
@@ -114,7 +114,7 @@
         assert not testrep.passed
         assert testrep.setupfailure 
         assert testrep.failed # ???
-        
+       
         # xxx repr_run of setupfailures should always 
         # display python Tracebacks starting from the 
         # failing setup function



More information about the pytest-commit mailing list