[Checkins] SVN: zc.sourcerelease/trunk/ * Made tests compatible with distribute.

Michael Howitz mh at gocept.com
Thu May 5 03:18:56 EDT 2011


Log message for revision 121554:
  * Made tests compatible with distribute.
  
  * Added test extra to declare test dependency on ``zope.testing``.
  

Changed:
  U   zc.sourcerelease/trunk/buildout.cfg
  U   zc.sourcerelease/trunk/setup.py
  U   zc.sourcerelease/trunk/src/zc/sourcerelease/CHANGES.txt
  U   zc.sourcerelease/trunk/src/zc/sourcerelease/README.txt
  U   zc.sourcerelease/trunk/src/zc/sourcerelease/__init__.py
  U   zc.sourcerelease/trunk/src/zc/sourcerelease/tests.py

-=-
Modified: zc.sourcerelease/trunk/buildout.cfg
===================================================================
--- zc.sourcerelease/trunk/buildout.cfg	2011-05-05 06:47:50 UTC (rev 121553)
+++ zc.sourcerelease/trunk/buildout.cfg	2011-05-05 07:18:56 UTC (rev 121554)
@@ -1,14 +1,13 @@
-
 [buildout]
 develop = .
-parts = script
+parts = script test
 
 [test]
 recipe = zc.recipe.testrunner
-eggs = zc.sourcerelease
+eggs = zc.sourcerelease [test]
 
 
 [script]
 recipe = zc.recipe.egg
-eggs = ${test:eggs}
+eggs = zc.sourcerelease
 interpreter = py

Modified: zc.sourcerelease/trunk/setup.py
===================================================================
--- zc.sourcerelease/trunk/setup.py	2011-05-05 06:47:50 UTC (rev 121553)
+++ zc.sourcerelease/trunk/setup.py	2011-05-05 07:18:56 UTC (rev 121554)
@@ -58,4 +58,8 @@
         'zc.buildout',
         'zc.recipe.egg',
         ],
+    extras_require=dict(
+        test=[
+            'zope.testing',
+            ]),
     )

Modified: zc.sourcerelease/trunk/src/zc/sourcerelease/CHANGES.txt
===================================================================
--- zc.sourcerelease/trunk/src/zc/sourcerelease/CHANGES.txt	2011-05-05 06:47:50 UTC (rev 121553)
+++ zc.sourcerelease/trunk/src/zc/sourcerelease/CHANGES.txt	2011-05-05 07:18:56 UTC (rev 121554)
@@ -1,6 +1,15 @@
 Release History
 ===============
 
+0.3.2 (unreleased)
+------------------
+
+* Made tests compatible with distribute.
+
+* Added test extra to declare test dependency on ``zope.testing``.
+
+
+
 0.3.1 (2009-09-25)
 ------------------
 
@@ -21,7 +30,7 @@
 ++++++++++
 
 Having an absolute eggs-directory in buildout.cfg will now give an
-error instead of running forever trying to find a relative path. 
+error instead of running forever trying to find a relative path.
 
 0.2 (2007-10-25)
 ----------------

Modified: zc.sourcerelease/trunk/src/zc/sourcerelease/README.txt
===================================================================
--- zc.sourcerelease/trunk/src/zc/sourcerelease/README.txt	2011-05-05 06:47:50 UTC (rev 121553)
+++ zc.sourcerelease/trunk/src/zc/sourcerelease/README.txt	2011-05-05 07:18:56 UTC (rev 121554)
@@ -14,7 +14,7 @@
 downloads data but does not store the downloaded data in the buildout
 download cache, then the data will not be included in the source
 release and will have to be downloaded when the source release is
-installed. 
+installed.
 
 The source release includes a Python install script.  It is not
 executable and must be run with the desired Python, which must be the
@@ -44,7 +44,7 @@
 be used with non-subversion source-code control systems.
 
 Let's look at an example.  We have a server with some distributions on
-it. 
+it.
 
     >>> print get(link_server),
     <html><body>
@@ -63,12 +63,12 @@
 
     >>> mkdir('sample')
     >>> sample = join(sample_buildout, 'sample')
-    >>> write(sample, 'buildout.cfg', 
+    >>> write(sample, 'buildout.cfg',
     ... '''
     ... [buildout]
     ... parts = sample
     ... find-links = %(link_server)s
-    ... 
+    ...
     ... [sample]
     ... recipe = zc.recipe.egg
     ... eggs = sample1
@@ -81,6 +81,7 @@
     ... # doctest: +ELLIPSIS
     Creating source release in sample.tgz
     ...
+    Generated script '...sample1'.
 
 We end up with a tar file:
 
@@ -153,13 +154,12 @@
 It has a release-distributions directory containing distributions
 needed to install the buildout:
 
-    >>> ls('test', 'sample', 'release-distributions', 'dist')
+    >>> ls('test', 'sample', 'release-distributions', 'dist') # doctest: +ELLIPSIS
     -  sample1-1.0.zip
-    -  sample2-1.0.zip
-    -  zc.buildout-99.99-pyN.N.egg
+    -  sample2-1.0.zip...
     -  zc.recipe.egg-1.0.0b6-py2.4.egg
 
-(There normally aren't distributions for buildout and setuptools
+(There normally aren't distributions for buildout and setuptools, etc.
 because these are pre-installed in the eggs directory of the source
 release. In this case, we have a release for zc.buildout because it
 was downloaded from the link server.  Anything that we downloaded is
@@ -279,13 +279,13 @@
 create one with an error as it contains an absolute path for the
 eggs-directory.
 
-    >>> write(sample, 'wrong.cfg', 
+    >>> write(sample, 'wrong.cfg',
     ... '''
     ... [buildout]
     ... parts = sample
     ... find-links = %(link_server)s
     ... eggs-directory = /somewhere/shared-eggs
-    ... 
+    ...
     ... [sample]
     ... recipe = zc.recipe.egg
     ... eggs = sample1

Modified: zc.sourcerelease/trunk/src/zc/sourcerelease/__init__.py
===================================================================
--- zc.sourcerelease/trunk/src/zc/sourcerelease/__init__.py	2011-05-05 06:47:50 UTC (rev 121553)
+++ zc.sourcerelease/trunk/src/zc/sourcerelease/__init__.py	2011-05-05 07:18:56 UTC (rev 121554)
@@ -115,8 +115,13 @@
         os.chdir(here)
 
         env = pkg_resources.Environment([eggs_directory])
+        projects = ['zc.buildout']
+        if env['setuptools']:
+            projects.append('setuptools')
+        else:
+            projects.append('distribute')
         dists = [env[project][0].location
-                 for project in ('zc.buildout', 'setuptools')]
+                 for project in projects]
 
         eggs = os.path.join(co2, reggs)
         os.mkdir(eggs)

Modified: zc.sourcerelease/trunk/src/zc/sourcerelease/tests.py
===================================================================
--- zc.sourcerelease/trunk/src/zc/sourcerelease/tests.py	2011-05-05 06:47:50 UTC (rev 121553)
+++ zc.sourcerelease/trunk/src/zc/sourcerelease/tests.py	2011-05-05 07:18:56 UTC (rev 121554)
@@ -45,7 +45,7 @@
 
 py_template = """
 def main():
-    print 'Hello. My name is ', %r 
+    print 'Hello. My name is ', %r
 
 """
 
@@ -110,12 +110,12 @@
     eggname, oldver, pyver = egg_parse(
         os.path.basename(dist.location)
         ).groups()
-    dest = os.path.join(sample_eggs, "%s-99.99-py%s.egg" % (eggname, pyver)) 
+    dest = os.path.join(sample_eggs, "%s-99.99-py%s.egg" % (eggname, pyver))
     shutil.copy(dist.location, dest)
     zip = zipfile.ZipFile(dest, 'a')
     zip.writestr(
         'EGG-INFO/PKG-INFO',
-        zip.read('EGG-INFO/PKG-INFO').replace("Version: %s" % oldver, 
+        zip.read('EGG-INFO/PKG-INFO').replace("Version: %s" % oldver,
                                               "Version: 99.99")
         )
     zip.close()
@@ -131,7 +131,11 @@
         checker=renormalizing.RENormalizing([
                zc.buildout.testing.normalize_path,
                zc.buildout.testing.normalize_egg_py,
-               (re.compile('-\S+-py'), ''),
+                (re.compile('-\S+-py'), ''),
+                # support both distribute and setuptools:
+                (re.compile('<a href="distributeN.N.egg</a><br>\n'), ''),
+                (re.compile('<a href="setuptoolsN.N.egg</a><br>\n'), ''),
+                (re.compile('d  distributeN.N.egg'), '-  setuptoolsN.N.egg'),
                ]),
         ),
         ))



More information about the checkins mailing list