[Checkins] SVN: z3c.recipe.eggbasket/trunk/ Add tests,
with two test packages.
Maurits van Rees
m.van.rees at zestsoftware.nl
Mon May 5 19:41:45 EDT 2008
Log message for revision 86473:
Add tests, with two test packages.
Changed:
U z3c.recipe.eggbasket/trunk/TODO.txt
U z3c.recipe.eggbasket/trunk/z3c/recipe/eggbasket/README.txt
U z3c.recipe.eggbasket/trunk/z3c/recipe/eggbasket/__init__.py
A z3c.recipe.eggbasket/trunk/z3c/recipe/eggbasket/tests/colour/
A z3c.recipe.eggbasket/trunk/z3c/recipe/eggbasket/tests/colour/README.txt
A z3c.recipe.eggbasket/trunk/z3c/recipe/eggbasket/tests/colour/colour/
A z3c.recipe.eggbasket/trunk/z3c/recipe/eggbasket/tests/colour/colour/__init__.py
A z3c.recipe.eggbasket/trunk/z3c/recipe/eggbasket/tests/colour/setup.py
A z3c.recipe.eggbasket/trunk/z3c/recipe/eggbasket/tests/orange/
A z3c.recipe.eggbasket/trunk/z3c/recipe/eggbasket/tests/orange/README.txt
A z3c.recipe.eggbasket/trunk/z3c/recipe/eggbasket/tests/orange/orange/
A z3c.recipe.eggbasket/trunk/z3c/recipe/eggbasket/tests/orange/orange/__init__.py
A z3c.recipe.eggbasket/trunk/z3c/recipe/eggbasket/tests/orange/setup.py
U z3c.recipe.eggbasket/trunk/z3c/recipe/eggbasket/tests/test_docs.py
-=-
Modified: z3c.recipe.eggbasket/trunk/TODO.txt
===================================================================
--- z3c.recipe.eggbasket/trunk/TODO.txt 2008-05-05 21:55:51 UTC (rev 86472)
+++ z3c.recipe.eggbasket/trunk/TODO.txt 2008-05-05 23:41:43 UTC (rev 86473)
@@ -1 +1 @@
-* Add tests.
+* Add more tests.
Modified: z3c.recipe.eggbasket/trunk/z3c/recipe/eggbasket/README.txt
===================================================================
--- z3c.recipe.eggbasket/trunk/z3c/recipe/eggbasket/README.txt 2008-05-05 21:55:51 UTC (rev 86472)
+++ z3c.recipe.eggbasket/trunk/z3c/recipe/eggbasket/README.txt 2008-05-05 23:41:43 UTC (rev 86473)
@@ -70,40 +70,91 @@
Example usage
=============
-.. Note to recipe author!
- ----------------------
- zc.buildout provides a nice testing environment which makes it
- relatively easy to write doctests that both demonstrate the use of
- the recipe and test it.
- You can find examples of recipe doctests from the PyPI, e.g.
-
- http://pypi.python.org/pypi/zc.recipe.egg
+We have a package ``orange`` that depends on the package ``colour``.
- The PyPI page for zc.buildout contains documentation about the test
- environment.
+ >>> import os.path
+ >>> import z3c.recipe.eggbasket.tests as testdir
+ >>> orange = os.path.join(os.path.dirname(testdir.__file__), 'orange')
+ >>> colour = os.path.join(os.path.dirname(testdir.__file__), 'colour')
- http://pypi.python.org/pypi/zc.buildout#testing-support
+We create source distributions for them in a directory::
- Below is a skeleton doctest that you can start with when building
- your own tests.
+ >>> colours = tmpdir('colours')
+ >>> sdist(orange, colours)
+ >>> sdist(colour, colours)
+ >>> ls(colours)
+ - colour-0.1.zip
+ - orange-0.1.zip
-We'll start by creating a buildout that uses the recipe::
+We will define a buildout template that uses the recipe::
- >>> write('buildout.cfg',
- ... """
+ >>> buildout_template = """
... [buildout]
- ... parts = test1
+ ... parts = basket
...
- ... [test1]
+ ... [basket]
... recipe = z3c.recipe.eggbasket
- ... option1 = %(foo)s
- ... option2 = %(bar)s
- ... """ % { 'foo' : 'value1', 'bar' : 'value2'})
+ ... eggs = %(eggs)s
+ ... url = %(url)s
+ ... """
-Running the buildout gives us::
+We'll start by creating a buildout that does not specify an egg::
+ >>> write('buildout.cfg', buildout_template % { 'eggs': '', 'url' : 'http://nowhere'})
+
+In this case the recipe will do nothing. So the url does not get
+used. Running the buildout gives us::
+
>>> print system(buildout)
- Installing test1.
- Unused options for test1: 'option2' 'option1'.
+ Installing basket.
+ Unused options for basket: 'url'.
+ <BLANKLINE>
+Next we will specify an egg but not refer to a bad url::
+ >>> write('buildout.cfg', buildout_template % { 'eggs': 'orange', 'url' : 'http://nowhere'})
+ >>> print system(buildout)
+ Uninstalling basket.
+ Installing basket.
+ Couldn't find index page for 'orange' (maybe misspelled?)
+ Getting distribution for 'orange'.
+ basket: Distributions are not installed. A tarball will be downloaded.
+ basket: Downloading http://nowhere ...
+ basket: Url not found: http://nowhere.
+ <BLANKLINE>
+
+So now we create a tar ball in a directory::
+
+ >>> import tarfile
+ >>> tarserver = tmpdir('tarserver')
+ >>> cd(tarserver)
+ >>> tarball = tarfile.open('colours.tgz', 'w:gz')
+ >>> tarball.add(colours)
+ >>> tarball.list(verbose=False)
+ tmp/tmpDlQSIQbuildoutSetUp/_TEST_/colours/
+ tmp/tmpDlQSIQbuildoutSetUp/_TEST_/colours/orange-0.1.zip
+ tmp/tmpDlQSIQbuildoutSetUp/_TEST_/colours/colour-0.1.zip
+ >>> tarball.close()
+ >>> ls(tarserver)
+ - colours.tgz
+
+We make it available on a url and use it in our buildout::
+
+ >>> cd(sample_buildout)
+ >>> tarball_url = 'file://' + tarserver + '/colours.tgz'
+ >>> write('buildout.cfg', buildout_template % { 'eggs': 'orange', 'url' : tarball_url})
+ >>> print system(buildout)
+ Uninstalling basket.
+ Installing basket.
+ Couldn't find index page for 'orange' (maybe misspelled?)
+ Getting distribution for 'orange'.
+ basket: Distributions are not installed. A tarball will be downloaded.
+ basket: Downloading .../tarserver/colours.tgz ...
+ basket: Finished downloading.
+ basket: Extracting tarball contents...
+ basket: Installing eggs to .../sample-buildout/eggs which will take a while...
+ Getting distribution for 'orange'.
+ Got orange 0.1.
+ Getting distribution for 'colour'.
+ Got colour 0.1.
+ <BLANKLINE>
Modified: z3c.recipe.eggbasket/trunk/z3c/recipe/eggbasket/__init__.py
===================================================================
--- z3c.recipe.eggbasket/trunk/z3c/recipe/eggbasket/__init__.py 2008-05-05 21:55:51 UTC (rev 86472)
+++ z3c.recipe.eggbasket/trunk/z3c/recipe/eggbasket/__init__.py 2008-05-05 23:41:43 UTC (rev 86473)
@@ -31,8 +31,8 @@
if not distributions_are_installed_in_dir(distributions,
options['eggs-directory']):
- log.info("Grok is not installed. "
- "A grok tarball will be downloaded.")
+ log.info("Distributions are not installed. "
+ "A tarball will be downloaded.")
url = self.options.get('url')
tarball_name = url.split('/')[-1]
log.info("Downloading %s ..." % url)
@@ -50,15 +50,15 @@
return tuple()
tarball.close()
log.info("Finished downloading.")
- log.info("Installing eggs to %s which will take a while..."
- % options['eggs-directory'])
+ log.info("Extracting tarball contents...")
try:
- tf = tarfile.open(temp_tarball_name,
- 'r:gz')
- except tarfile.ReadError:
+ tf = tarfile.open(temp_tarball_name, 'r:gz')
+ except tarfile.ReadError, e:
# Likely the download location is wrong and gives a 404.
+ # Or the tarball is not zipped.
log.error("No correct tarball found at %s." % url)
+ log.error("The error was: %s" % e)
return tuple()
links = []
@@ -67,7 +67,8 @@
links.append(os.path.join(extraction_dir, name))
tf.close()
- log.info("installing grok. This will take a while...")
+ log.info("Installing eggs to %s which will take a while..."
+ % options['eggs-directory'])
result = install_distributions(
distributions, options['eggs-directory'],
links = links)
Added: z3c.recipe.eggbasket/trunk/z3c/recipe/eggbasket/tests/colour/README.txt
===================================================================
--- z3c.recipe.eggbasket/trunk/z3c/recipe/eggbasket/tests/colour/README.txt (rev 0)
+++ z3c.recipe.eggbasket/trunk/z3c/recipe/eggbasket/tests/colour/README.txt 2008-05-05 23:41:43 UTC (rev 86473)
@@ -0,0 +1 @@
+Colours
Property changes on: z3c.recipe.eggbasket/trunk/z3c/recipe/eggbasket/tests/colour/README.txt
___________________________________________________________________
Name: svn:eol-style
+ native
Added: z3c.recipe.eggbasket/trunk/z3c/recipe/eggbasket/tests/colour/colour/__init__.py
===================================================================
--- z3c.recipe.eggbasket/trunk/z3c/recipe/eggbasket/tests/colour/colour/__init__.py (rev 0)
+++ z3c.recipe.eggbasket/trunk/z3c/recipe/eggbasket/tests/colour/colour/__init__.py 2008-05-05 23:41:43 UTC (rev 86473)
@@ -0,0 +1 @@
+#
Property changes on: z3c.recipe.eggbasket/trunk/z3c/recipe/eggbasket/tests/colour/colour/__init__.py
___________________________________________________________________
Name: svn:eol-style
+ native
Added: z3c.recipe.eggbasket/trunk/z3c/recipe/eggbasket/tests/colour/setup.py
===================================================================
--- z3c.recipe.eggbasket/trunk/z3c/recipe/eggbasket/tests/colour/setup.py (rev 0)
+++ z3c.recipe.eggbasket/trunk/z3c/recipe/eggbasket/tests/colour/setup.py 2008-05-05 23:41:43 UTC (rev 86473)
@@ -0,0 +1,26 @@
+from setuptools import setup, find_packages
+import sys, os
+
+version = '0.1'
+
+setup(name='colour',
+ version=version,
+ description="Basic colour package",
+ long_description="""\
+""",
+ classifiers=[], # Get strings from http://pypi.python.org/pypi?%3Aaction=list_classifiers
+ keywords='',
+ author='Maurits',
+ author_email='email',
+ url='http://nowhere',
+ license='',
+ packages=find_packages(exclude=['ez_setup', 'examples', 'tests']),
+ include_package_data=True,
+ zip_safe=False,
+ install_requires=[
+ # -*- Extra requirements: -*-
+ ],
+ entry_points="""
+ # -*- Entry points: -*-
+ """,
+ )
Property changes on: z3c.recipe.eggbasket/trunk/z3c/recipe/eggbasket/tests/colour/setup.py
___________________________________________________________________
Name: svn:eol-style
+ native
Added: z3c.recipe.eggbasket/trunk/z3c/recipe/eggbasket/tests/orange/README.txt
===================================================================
--- z3c.recipe.eggbasket/trunk/z3c/recipe/eggbasket/tests/orange/README.txt (rev 0)
+++ z3c.recipe.eggbasket/trunk/z3c/recipe/eggbasket/tests/orange/README.txt 2008-05-05 23:41:43 UTC (rev 86473)
@@ -0,0 +1 @@
+The colour orange
Property changes on: z3c.recipe.eggbasket/trunk/z3c/recipe/eggbasket/tests/orange/README.txt
___________________________________________________________________
Name: svn:eol-style
+ native
Added: z3c.recipe.eggbasket/trunk/z3c/recipe/eggbasket/tests/orange/orange/__init__.py
===================================================================
--- z3c.recipe.eggbasket/trunk/z3c/recipe/eggbasket/tests/orange/orange/__init__.py (rev 0)
+++ z3c.recipe.eggbasket/trunk/z3c/recipe/eggbasket/tests/orange/orange/__init__.py 2008-05-05 23:41:43 UTC (rev 86473)
@@ -0,0 +1 @@
+#
Property changes on: z3c.recipe.eggbasket/trunk/z3c/recipe/eggbasket/tests/orange/orange/__init__.py
___________________________________________________________________
Name: svn:eol-style
+ native
Added: z3c.recipe.eggbasket/trunk/z3c/recipe/eggbasket/tests/orange/setup.py
===================================================================
--- z3c.recipe.eggbasket/trunk/z3c/recipe/eggbasket/tests/orange/setup.py (rev 0)
+++ z3c.recipe.eggbasket/trunk/z3c/recipe/eggbasket/tests/orange/setup.py 2008-05-05 23:41:43 UTC (rev 86473)
@@ -0,0 +1,27 @@
+from setuptools import setup, find_packages
+import sys, os
+
+version = '0.1'
+
+setup(name='orange',
+ version=version,
+ description="The colour orange",
+ long_description="""\
+""",
+ classifiers=[], # Get strings from http://pypi.python.org/pypi?%3Aaction=list_classifiers
+ keywords='',
+ author='Maurits',
+ author_email='email',
+ url='http://nowhere',
+ license='',
+ packages=find_packages(exclude=['ez_setup', 'examples', 'tests']),
+ include_package_data=True,
+ zip_safe=False,
+ install_requires=[
+ 'colour',
+ # -*- Extra requirements: -*-
+ ],
+ entry_points="""
+ # -*- Entry points: -*-
+ """,
+ )
Property changes on: z3c.recipe.eggbasket/trunk/z3c/recipe/eggbasket/tests/orange/setup.py
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: z3c.recipe.eggbasket/trunk/z3c/recipe/eggbasket/tests/test_docs.py
===================================================================
--- z3c.recipe.eggbasket/trunk/z3c/recipe/eggbasket/tests/test_docs.py 2008-05-05 21:55:51 UTC (rev 86472)
+++ z3c.recipe.eggbasket/trunk/z3c/recipe/eggbasket/tests/test_docs.py 2008-05-05 23:41:43 UTC (rev 86473)
@@ -21,7 +21,7 @@
zc.buildout.testing.install_develop('z3c.recipe.eggbasket', test)
# Install any other recipes that should be available in the tests
- #zc.buildout.testing.install('collective.recipe.foobar', test)
+ #zc.buildout.testing.install('zc.recipe.egg', test)
def test_suite():
suite = unittest.TestSuite((
More information about the Checkins
mailing list