[Checkins] SVN: zc.buildout/trunk/src/zc/buildout/tests.py Now, when loading extensions, we search find links and the index.

Jim Fulton jim at zope.com
Mon Jun 18 20:30:54 EDT 2007


Log message for revision 76778:
  Now, when loading extensions, we search find links and the index.
  
  Removed a test that was obsoleted by a setuptools improvement in
  handling failed downloads.
  
  Updated to reflect a change in bootstrapping. (I wonder why this
  wasn't needed sooner.)
  

Changed:
  U   zc.buildout/trunk/src/zc/buildout/tests.py

-=-
Modified: zc.buildout/trunk/src/zc/buildout/tests.py
===================================================================
--- zc.buildout/trunk/src/zc/buildout/tests.py	2007-06-19 00:30:48 UTC (rev 76777)
+++ zc.buildout/trunk/src/zc/buildout/tests.py	2007-06-19 00:30:52 UTC (rev 76778)
@@ -584,17 +584,22 @@
              )
           ),
        'bootstrap', 'bootstrap.py')
+
 if os.path.exists(bootstrap_py):
     def test_bootstrap_py():
         """Make sure the bootstrap script actually works
 
     >>> sample_buildout = tmpdir('sample')
     >>> os.chdir(sample_buildout)
+    >>> write('buildout.cfg',
+    ... '''
+    ... [buildout]
+    ... parts =
+    ... ''')
     >>> write('bootstrap.py', open(bootstrap_py).read())
     >>> print system(sys.executable+' '+'bootstrap.py'), # doctest: +ELLIPSIS
     Downloading ...
-    Warning: creating ...buildout.cfg
-    ...Generated script /sample/bin/buildout.
+    Generated script '/sample/bin/buildout'.
 
     >>> ls(sample_buildout)
     d  bin
@@ -1375,23 +1380,6 @@
     global name 'os' is not defined
     """
 
-def download_errors():
-    """
-    >>> write(sample_buildout, 'buildout.cfg',
-    ... '''
-    ... [buildout]
-    ... parts = 
-    ... find-links = http://127.0.0.1/no-shuch-thing
-    ... ''')
-
-    >>> print system(buildout), # doctest: +ELLIPSIS
-    While:
-      Installing.
-      Checking for upgrades.
-      Getting distribution for 'setuptools'.
-    Error: Download error...
-    """
-
 def whine_about_unused_options():
     '''
 
@@ -2029,7 +2017,62 @@
     Error: Couldn't find a distribution for 'pack5'.
     """
 
+def read_find_links_to_load_extensions():
+    """
+We'll create a wacky buildout extension that is just another name for http:
 
+    >>> src = tmpdir('src')
+    >>> write(src, 'wacky_handler.py',
+    ... '''
+    ... import urllib2
+    ... class Wacky(urllib2.HTTPHandler):
+    ...     wacky_open = urllib2.HTTPHandler.http_open
+    ... def install(buildout=None):
+    ...     urllib2.install_opener(urllib2.build_opener(Wacky))
+    ... ''')
+    >>> write(src, 'setup.py',
+    ... '''
+    ... from setuptools import setup
+    ... setup(name='wackyextension', version='1',
+    ...       py_modules=['wacky_handler'],
+    ...       entry_points = {'zc.buildout.extension':
+    ...             ['default = wacky_handler:install']
+    ...             },
+    ...       )
+    ... ''')
+    >>> print system(buildout+' setup '+src+' bdist_egg'),
+    ... # doctest: +ELLIPSIS
+    Running setup ...
+    creating 'dist/wackyextension-1-...
+
+Now we'll create a buildout that uses this extension to load other packages:
+
+    >>> wacky_server = link_server.replace('http', 'wacky')
+    >>> dist = 'file://'+join(src, 'dist')
+    >>> write('buildout.cfg',
+    ... '''
+    ... [buildout]
+    ... parts = demo
+    ... extensions = wackyextension
+    ... find-links = %(wacky_server)s/demoneeded-1.0.zip
+    ...              %(dist)s
+    ... [demo]
+    ... recipe = zc.recipe.egg
+    ... eggs = demoneeded
+    ... ''' % globals())
+
+When we run the buildout. it will load the extension from the dist
+directory and then use the wacky extension to load the demo package
+
+    >>> print system(buildout),
+    Getting distribution for 'wackyextension'.
+    Got wackyextension 1.
+    Installing demo.
+    Getting distribution for 'demoneeded'.
+    Got demoneeded 1.0.
+    
+    """
+
 ######################################################################
     
 def create_sample_eggs(test, executable=sys.executable):



More information about the Checkins mailing list