[py-svn] pylib commit 64c4901145ff: fix recursion handling (failed on windows)

commits-noreply at bitbucket.org commits-noreply at bitbucket.org
Sun Nov 7 17:33:24 CET 2010


# HG changeset patch -- Bitbucket.org
# Project pylib
# URL http://bitbucket.org/hpk42/pylib/overview
# User holger krekel <holger at merlinux.eu>
# Date 1289147700 -3600
# Node ID 64c4901145ffb29356f00cbdd4aea35fce9474c2
# Parent  50db633de97b3626c0a07fbe8911856e2c14988b
fix recursion handling (failed on windows)

--- a/py/_path/common.py
+++ b/py/_path/common.py
@@ -327,13 +327,13 @@ class Visitor:
     def __init__(self, fil, rec, ignore, bf, sort):
         if isinstance(fil, str):
             fil = FNMatcher(fil)
-        if rec:
-            if isinstance(rec, str):
-                rec = fnmatch(fil)
-            else:
-                assert hasattr(rec, '__call__')
+        if isinstance(rec, str):
+            self.rec = fnmatch(fil)
+        elif not hasattr(rec, '__call__') and rec:
+            self.rec = lambda path: True
+        else:
+            self.rec = rec
         self.fil = fil
-        self.rec = rec
         self.ignore = ignore
         self.breadthfirst = bf
         self.optsort = sort and sorted or (lambda x: x)



More information about the pytest-commit mailing list