[Checkins] SVN: zc.buildout/trunk/ Require newlines to separate distributions in a distributions

Jim Fulton jim at zope.com
Fri Jun 9 19:31:09 EDT 2006


Log message for revision 68562:
  Require newlines to separate distributions in a distributions
  option. The values are setuptools requirements and can have spaces in
  them.
  

Changed:
  U   zc.buildout/trunk/buildout.cfg
  U   zc.buildout/trunk/testrunnerrecipe/src/zc/recipe/testrunner/README.txt
  U   zc.buildout/trunk/testrunnerrecipe/src/zc/recipe/testrunner/__init__.py

-=-
Modified: zc.buildout/trunk/buildout.cfg
===================================================================
--- zc.buildout/trunk/buildout.cfg	2006-06-09 22:07:32 UTC (rev 68561)
+++ zc.buildout/trunk/buildout.cfg	2006-06-09 23:31:08 UTC (rev 68562)
@@ -4,5 +4,8 @@
 
 [test]
 recipe = zc.recipe.testrunner
-distributions = zc.buildout zc.recipe.egg zc.recipe.testrunner
+distributions = 
+  zc.buildout 
+  zc.recipe.egg 
+  zc.recipe.testrunner
 

Modified: zc.buildout/trunk/testrunnerrecipe/src/zc/recipe/testrunner/README.txt
===================================================================
--- zc.buildout/trunk/testrunnerrecipe/src/zc/recipe/testrunner/README.txt	2006-06-09 22:07:32 UTC (rev 68561)
+++ zc.buildout/trunk/testrunnerrecipe/src/zc/recipe/testrunner/README.txt	2006-06-09 23:31:08 UTC (rev 68562)
@@ -6,9 +6,12 @@
 
 The rest-runner recipe has 2 options:
 
-- The distributions option takes the names of the distributions to be tested.
-  These are not installed by the recipe. They must be installed by
-  some other recipe.  This option is required.
+- The distributions option takes the names of the distributions to be
+  tested.  These are not installed by the recipe. They must be
+  installed by some other recipe (or using the buildout develop
+  option).  The distributions are in the form os setuptools
+  requirements.  Multiple distributions must be listed on separate
+  lines. This option is required.
 
 - The script option gives the name of the script to generate, in the
   buildout bin directory.  Of the option isn't used, the part name
@@ -17,7 +20,8 @@
 (Note that, at this time, due to limitations in the Zope test runner,
  the distributions cannot be zip files. TODO: Fix the test runner!)
 
-To illustrate this, we'll create a project in our sample buildout:
+To illustrate this, we'll create a pair of projects in our sample
+buildout:
 
     >>> mkdir(sample_buildout, 'demo')
     >>> write(sample_buildout, 'demo', 'tests.py',
@@ -41,21 +45,48 @@
 
     >>> write(sample_buildout, 'demo', 'README.txt', '')
 
+    >>> mkdir(sample_buildout, 'demo2')
+    >>> write(sample_buildout, 'demo2', 'tests.py',
+    ... '''
+    ... import unittest
+    ...
+    ... class TestSomething(unittest.TestCase):
+    ...    def test_something(self):
+    ...        pass
+    ...
+    ... def test_suite():
+    ...     return unittest.makeSuite(TestSomething)
+    ... ''')
+
+    >>> write(sample_buildout, 'demo2', 'setup.py',
+    ... """
+    ... from setuptools import setup
+    ... 
+    ... setup(name = "demo2")
+    ... """)
+
+    >>> write(sample_buildout, 'demo2', 'README.txt', '')
+
 We'll update our buildout to install the demo project as a
 develop egg and to create the test script:
 
     >>> write(sample_buildout, 'buildout.cfg',
     ... """
     ... [buildout]
-    ... develop = demo
+    ... develop = demo demo2
     ... parts = testdemo
     ...
     ... [testdemo]
     ... recipe = zc.recipe.testrunner
-    ... distributions = demo
+    ... distributions = 
+    ...    demo
+    ...    demo2
     ... script = test
     ... """)
 
+Note that we specified both demo and demo2 in the distributions
+section and that we put them on separate lines.
+
 Now when we run the buildout:
 
     >>> import os
@@ -72,7 +103,7 @@
 
     >>> print system(os.path.join(sample_buildout, 'bin', 'test')),
     Running unit tests:
-      Ran 1 tests with 0 failures and 0 errors in 0.000 seconds.
+      Ran 2 tests with 0 failures and 0 errors in 0.000 seconds.
 
 If we leave the script option out of the configuration, then the test
 script will get it's name from the part:

Modified: zc.buildout/trunk/testrunnerrecipe/src/zc/recipe/testrunner/__init__.py
===================================================================
--- zc.buildout/trunk/testrunnerrecipe/src/zc/recipe/testrunner/__init__.py	2006-06-09 22:07:32 UTC (rev 68561)
+++ zc.buildout/trunk/testrunnerrecipe/src/zc/recipe/testrunner/__init__.py	2006-06-09 23:31:08 UTC (rev 68562)
@@ -27,12 +27,15 @@
         self.options = options
 
     def install(self):
-        distributions = self.options['distributions'].split()
+        distributions = [
+            req.strip()
+            for req in self.options['distributions'].split('\n')
+            if req.split()
+            ]
         path = zc.buildout.egglinker.path(
             distributions+['zope.testing'],
             [self.buildout.eggs],
             )
-        
         locations = [zc.buildout.egglinker.location(distribution,
                                                     [self.buildout.eggs])
                      for distribution in distributions]



More information about the Checkins mailing list