[py-dev] branch py-collect was: Bug in collect.Error

Jan Balster jan at balster.info
Wed Mar 16 14:38:48 CET 2005


hi holger,


> Yes, that return value is one of the missing bits in the branch! 
> I'll try to finish that up asap. 
> 

may i help?

below a diff for run.py and drive.py.
FrontendDriver(run.py) and Driver(drive.py) communicate only with lists
and tuples of strings.

hope this helps.

Jan


output of "svn diff run.py":
Index: run.py
===================================================================
--- run.py      (Revision 9787)
+++ run.py      (Arbeitskopie)
@@ -94,7 +94,7 @@
     args, failures = channel.receive()
     driver, paths = py.test.config.init(args, ignoreremote=True)
     if failures:
-        cols = [FailureCollector(failures)]
+        cols = FailureCollector(failures)
     else:
         cols = list(getcollectors(paths))
     driver.shouldclose = channel.isclosed
@@ -105,8 +105,15 @@
     def __init__(self, failures):
         self.failures = failures
     def __iter__(self):
-        for root, names in self.failures:
-            current = root
+        for rootpath, names in self.failures:
+            root = py.path.local(rootpath)
+            if root.check(dir=1):
+                current = py.test.Directory(root).Directory(root)
+            elif root.check(file=1):
+                current = py.test.Module(root).Module(root)
+            # root is fspath of names[0] -> pop names[0]
+            # slicing works with empty lists
+            names = names[1:]
             while names:
                 name = names.pop(0)
                 try:
@@ -143,8 +150,8 @@
                 break
             print "#" * 60
             print "# session mode: %d failures remaining" % len(failures)
-            for x in failures:
-                name = ":".join(x) # XXX
+            for root, names in failures:
+                name = ":".join(names) # XXX
                 print "Failure at: %r" % (name,)
             print "#    watching py files below %s" % rootdir
-            print "#                           ", "^" * len(rootdir)
+            print "#                           ", "^" * len(str(rootdir))

output of "svn diff drive.py":
Index: drive.py
===================================================================
--- drive.py    (Revision 9787)
+++ drive.py    (Arbeitskopie)
@@ -54,6 +54,11 @@
         except Exit, ex:
             pass

+        # return [(fspath as string, [names as string])]
+        return [(str(item.listchain()[0].fspath), item.listnames())
+                for item, res in self.getresults(py.test.Item.Failed)]
+
+
     def runone(self, colitem):
         if self.shouldclose():
             raise SystemExit, "received external close signal"



More information about the Pytest-dev mailing list