1 new commit in pytest:

https://bitbucket.org/hpk42/pytest/changeset/58eee296ceda/
changeset:   58eee296ceda
user:        RonnyPfannschmidt
date:        2011-12-01 19:36:44
summary:     simplify the loop in Node.listchain
affected #:  2 files

diff -r bfc767236dda1c9c517f35d446f956f8384390e1 -r 
58eee296cedaa9d329970074db0e4943c74a18c4 CHANGELOG
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -29,6 +29,7 @@
 - fix issue83: link to generated funcarg list
 - fix issue74: pyarg module names are now checked against imp.find_module 
false positives
 - fix compatibility with twisted/trial-11.1.0 use cases
+- simplify Node.listchain
 
 Changes between 2.1.2 and 2.1.3
 ----------------------------------------


diff -r bfc767236dda1c9c517f35d446f956f8384390e1 -r 
58eee296cedaa9d329970074db0e4943c74a18c4 _pytest/main.py
--- a/_pytest/main.py
+++ b/_pytest/main.py
@@ -229,13 +229,13 @@
     def listchain(self):
         """ return list of all parent collectors up to self,
             starting from root of collection tree. """
-        l = [self]
-        while 1:
-            x = l[0]
-            if x.parent is not None: # and x.parent.parent is not None:
-                l.insert(0, x.parent)
-            else:
-                return l
+        chain = []
+        item = self
+        while item is not None:
+            chain.append(item)
+            item = item.parent
+        chain.reverse()
+        return chain
 
     def listnames(self):
         return [x.name for x in self.listchain()]

Repository URL: https://bitbucket.org/hpk42/pytest/

--

This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
_______________________________________________
py-svn mailing list
py-svn@codespeak.net
http://codespeak.net/mailman/listinfo/py-svn

Reply via email to