[Checkins] SVN: zc.zope3recipes/branches/offline-recipe/zc/zope3recipes/ A workaround for test failures that occur with zc.buildout v1.5 or later and distribute as pointed out in:

Satchidanand Haridas satchit at zope.com
Thu Oct 20 15:26:19 EST 2011


Log message for revision 123132:
  A workaround for test failures that occur with zc.buildout v1.5 or later and distribute as pointed out in:
  
  https://mail.zope.org/pipermail/zope-dev/2011-January/042355.html
  
  

Changed:
  U   zc.zope3recipes/branches/offline-recipe/zc/zope3recipes/README.txt
  U   zc.zope3recipes/branches/offline-recipe/zc/zope3recipes/tests.py

-=-
Modified: zc.zope3recipes/branches/offline-recipe/zc/zope3recipes/README.txt
===================================================================
--- zc.zope3recipes/branches/offline-recipe/zc/zope3recipes/README.txt	2011-10-20 20:23:26 UTC (rev 123131)
+++ zc.zope3recipes/branches/offline-recipe/zc/zope3recipes/README.txt	2011-10-20 20:26:18 UTC (rev 123132)
@@ -456,9 +456,15 @@
     Generated script '/sample-buildout/parts/myapp/runzope'.
     Generated script '/sample-buildout/parts/myapp/debugzope'.
 
-A directory is created in the parts directory for our application files:
+A directory is created in the parts directory for our application
+files. Starting with zc.buildout >= v1.5, and distribute, a "buildout"
+directory is created in the parts folder. Since the minimum version we support
+for zc.buildout is lower than v1.5, we use a custom "ls" functional called
+"ls_optional" to which we pass a list of folders that may be present. These are
+ignore by the function.
 
-    >>> ls('parts')
+    >>> from zc.zope3recipes.tests import ls_optional
+    >>> ls_optional('parts', ignore=('buildout',))
     d  myapp
 
     >>> ls('parts', 'myapp')
@@ -1000,7 +1006,7 @@
 
 We get new directories for our database and instance:
 
-    >>> ls('parts')
+    >>> ls_optional('parts', ignore=('buildout',))
     d  database
     d  instance
     d  myapp
@@ -1949,7 +1955,7 @@
 
 The installer files will move.  We'll no-longer have the instance part:
 
-    >>> ls('parts')
+    >>> ls_optional('parts', ignore=('buildout',))
     d  database
     d  myapp
 

Modified: zc.zope3recipes/branches/offline-recipe/zc/zope3recipes/tests.py
===================================================================
--- zc.zope3recipes/branches/offline-recipe/zc/zope3recipes/tests.py	2011-10-20 20:23:26 UTC (rev 123131)
+++ zc.zope3recipes/branches/offline-recipe/zc/zope3recipes/tests.py	2011-10-20 20:26:18 UTC (rev 123132)
@@ -19,6 +19,21 @@
 import unittest
 from zope.testing import doctest, renormalizing
 
+def ls_optional(dir, ignore=(), *subs):
+    if subs:
+        dir = os.path.join(dir, *subs)
+    names = os.listdir(dir)
+    names.sort()
+    for name in names:
+        if name in ignore:
+            continue
+        if os.path.isdir(os.path.join(dir, name)):
+            print 'd ',
+        elif os.path.islink(os.path.join(dir, name)):
+            print 'l ',
+        else:
+            print '- ',
+        print name
 
 def test_ctl():
     """



More information about the checkins mailing list