[Checkins] SVN: zc.recipe.macro/trunk/src/zc/recipe/macro/ Test debugging.

Aaron Lehmann aaron at zope.com
Wed Jan 21 09:44:38 EST 2009


Log message for revision 94904:
  Test debugging.
  
  

Changed:
  U   zc.recipe.macro/trunk/src/zc/recipe/macro/QUICKSTART.txt
  U   zc.recipe.macro/trunk/src/zc/recipe/macro/README.txt
  U   zc.recipe.macro/trunk/src/zc/recipe/macro/tests.py

-=-
Modified: zc.recipe.macro/trunk/src/zc/recipe/macro/QUICKSTART.txt
===================================================================
--- zc.recipe.macro/trunk/src/zc/recipe/macro/QUICKSTART.txt	2009-01-21 14:32:30 UTC (rev 94903)
+++ zc.recipe.macro/trunk/src/zc/recipe/macro/QUICKSTART.txt	2009-01-21 14:44:37 UTC (rev 94904)
@@ -77,14 +77,14 @@
 
     [hard-rocker]
     recipe = zc.recipe.macro
-    result-recipe = zc.recipe.macro:empty
+    result-recipe = zc.recipe.macro:test
     macro = rock
     rocking-style = so hard
 
 Result::
 
     [hard-rocker]
-    recipe = zc.recipe.macro:empty
+    recipe = zc.recipe.macro:test
     result-sections = hard-rocker
     question = Why do I rock so hard?
     rocking-style = so hard
@@ -145,6 +145,57 @@
     rocking-style = all night
     question = Why do I rock all night?
 
+In the previous example we hardcoded the result parts after the invoker in
+${buildout:parts}.  This is brittle, because someone might change the names of
+the targets or alphabetize the parts list. An invocation will have a list of
+the sections it modified in its result-sections variable, which is created when
+the macro is executed.
+
+Buildout::
+
+    [buildout]
+    parts = ${rockers:result-sections}
+
+    [rock]
+    question = Why do I rock $${:rocking-style}?
+    rocking-style = $${:rocking-style}
+
+    [hard-rocker-parameters]
+    rocking-style = so hard
+
+    [socks-rocker-parameters]
+    rocking-style = my socks
+
+    [tired-rocker-parameters]
+    rocking-style = all night
+
+    [rockers]
+    recipe = zc.recipe.macro
+    result-recipe = zc.recipe.macro:test
+    macro = rock
+    targets =
+        hard-rocker:hard-rocker-parameters
+        socks-rocker:socks-rocker-parameters
+        tired-rocker:tired-rocker-parameters
+
+Result::
+
+    [hard-rocker]
+    question = Why do I rock so hard?
+    recipe = zc.recipe.macro:test
+    rocking-style = so hard
+
+    [socks-rocker]
+    question = Why do I rock my socks?
+    recipe = zc.recipe.macro:test
+    rocking-style = my socks
+
+    [tired-rocker]
+    question = Why do I rock all night?
+    recipe = zc.recipe.macro:test
+    rocking-style = all night
+
+
 Special Variables
 -----------------
 

Modified: zc.recipe.macro/trunk/src/zc/recipe/macro/README.txt
===================================================================
--- zc.recipe.macro/trunk/src/zc/recipe/macro/README.txt	2009-01-21 14:32:30 UTC (rev 94903)
+++ zc.recipe.macro/trunk/src/zc/recipe/macro/README.txt	2009-01-21 14:44:37 UTC (rev 94904)
@@ -400,9 +400,6 @@
     ...         return list(
     ...             reversed(sorted(zc.buildout.buildout.Options.keys(self))))
     >>> zc.recipe.macro.recipe.Options = OrderedOptions
-
-Now we'll make the buildout in memory, so that our monkeypatch will be effective:
-
     >>> buildout = setupBuildout(sample_buildout, "buildout.cfg",
     ... """
     ... [buildout]
@@ -456,8 +453,5 @@
             <product-config zc.z3monitor>
             port 8089
             </product-config>'}}
-
-And we'll return to the old Options:
-
     >>> zc.recipe.macro.recipe.Options = zc.buildout.buildout.Options
 

Modified: zc.recipe.macro/trunk/src/zc/recipe/macro/tests.py
===================================================================
--- zc.recipe.macro/trunk/src/zc/recipe/macro/tests.py	2009-01-21 14:32:30 UTC (rev 94903)
+++ zc.recipe.macro/trunk/src/zc/recipe/macro/tests.py	2009-01-21 14:44:37 UTC (rev 94904)
@@ -236,8 +236,9 @@
 
     m.extend(manuel_test)
     quickstart = manuel.testing.TestSuite(m, 'QUICKSTART.txt', setUp=bm.setUp)
-    quickstart = manuel.testing.TestSuite(m, 'README.txt', setUp=bm.setUp)
     suite.addTest(quickstart)
+    readme = manuel.testing.TestSuite(m, 'README.txt', setUp=bm.setUp)
+    suite.addTest(readme)
 
     return suite
 



More information about the Checkins mailing list