[py-svn] r6996 - in py/dist: doc py/test

hpk at codespeak.net hpk at codespeak.net
Mon Oct 18 02:45:04 CEST 2004


Author: hpk
Date: Mon Oct 18 02:45:04 2004
New Revision: 6996

Added:
   py/dist/doc/rest_test.py
Modified:
   py/dist/doc/test.txt
   py/dist/py/test/run.py
Log:
fixes and a test for the rest :-) 



Added: py/dist/doc/rest_test.py
==============================================================================
--- (empty file)
+++ py/dist/doc/rest_test.py	Mon Oct 18 02:45:04 2004
@@ -0,0 +1,30 @@
+from __future__ import generators 
+
+import py 
+
+mypath = py.magic.autopath() 
+mydir = mypath.dirpath()
+rest = mydir.dirpath('tool', 'rest.py')
+
+class RestItem(py.test.run.Item):
+    def __init__(self, path):
+        self.path = path 
+        self.pypath = py.path.extpy(mypath, 'RestItem.execute')
+
+    def execute(self, *args):
+        out = py.process.cmdexec("%s %s 2>&1" %(rest, self.path)) 
+        assert not out 
+             
+class Collector(py.test.collect.Module):
+    def __init__(self, extpy):
+        self.extpy = extpy 
+
+    def __iter__(self):
+        for x in mydir.listdir('*.txt'): 
+            yield RestItem(x) 
+        
+#def test_rest(p):
+#    out = py.process.cmdexec("%s %s" %(rest, mypath)) 
+#    print out 
+#    assert not out
+

Modified: py/dist/doc/test.txt
==============================================================================
--- py/dist/doc/test.txt	(original)
+++ py/dist/doc/test.txt	Mon Oct 18 02:45:04 2004
@@ -92,10 +92,12 @@
 to present nice tracebacks.  Tracebacks usually start 
 with your failing test function and they will abort early
 in case of recursion with a statement stating the
-recursion. 
+recursion.  If you run ``example/test/failure_demo.py`` you
+will see a variety of 40 tracebacks shown for different
+failure situations. 
 
 Managing test state across test modules, classes and methods 
------------------------------------------------------------- 
+------------------------------------------------------------
 
 Often you want to create some test files, db-connections or
 other state in order to run tests in a certain environment.  

Modified: py/dist/py/test/run.py
==============================================================================
--- py/dist/py/test/run.py	(original)
+++ py/dist/py/test/run.py	Mon Oct 18 02:45:04 2004
@@ -37,7 +37,7 @@
             if self.option.exitfirstproblem:
                 raise SystemExit, 2
         else:
-            raise TypeError("%r is not a Item or Info instance" % obj)
+            raise TypeError("%r is not a Item or Collector instance" % obj)
 
     def runcollector(self, collector):
         close = self.reporter.open(collector)



More information about the pytest-commit mailing list