[Checkins] SVN: zc.buildout/trunk/src/zc/buildout/upgrading_distribute.txt Adjusted the test so that it also works when you're testing with an older setuptools version and there's a new one on pypi.

Reinout van Rees reinout at vanrees.org
Fri Nov 27 05:52:42 EST 2009


Log message for revision 106059:
  Adjusted the test so that it also works when you're testing with an older setuptools version and there's a new one on pypi.
  In that case, the _call_easy_install call will really try to install setuptools first and execute other code paths than the test cares for.
  A cleaner way does not seem possible as the easy_install code is really intertwined.

Changed:
  U   zc.buildout/trunk/src/zc/buildout/upgrading_distribute.txt

-=-
Modified: zc.buildout/trunk/src/zc/buildout/upgrading_distribute.txt
===================================================================
--- zc.buildout/trunk/src/zc/buildout/upgrading_distribute.txt	2009-11-27 10:51:07 UTC (rev 106058)
+++ zc.buildout/trunk/src/zc/buildout/upgrading_distribute.txt	2009-11-27 10:52:41 UTC (rev 106059)
@@ -4,7 +4,7 @@
 Some initial test setup:
 
     >>> import sys
-    >>> import zc.buildout.easy_install
+    >>> import zc.buildout
     >>> dest = tmpdir('sample-install')
 
 Setuptools (0.6something) is packaged as an ``.egg``.  So when installing it,
@@ -28,6 +28,21 @@
 because of a non-existing tarball, but that's the OK for this corner case
 test: we only want to test that ``_get_dist()`` isn't getting called:
 
+    >>> class MockDist(object):
+    ...     def __str__(self):
+    ...         return 'nonexisting.tgz'
+    ...     @property
+    ...     def project_name(self):
+    ...         # Testing corner case: there *is* actually
+    ...         # a newer setuptools package on pypi than we
+    ...         # are running with, so it really installs it
+    ...         # and compares project_name. We're past the
+    ...         # point that we're testing, so we just raise
+    ...         # the normally expected error.
+    ...         raise zc.buildout.UserError(
+    ...             "Couldn't install: nonexisting.tgz")
+    >>> dist = MockDist()
+
     >>> installer = zc.buildout.easy_install.Installer(
     ...     dest=dest,
     ...     links=[link_server],
@@ -35,8 +50,7 @@
     ...     executable=sys.executable,
     ...     always_unzip=True)
     >>> installer._get_dist = mock_get_dist
-    >>> installer._call_easy_install('setuptools', None, dest, 
-    ...                              'nonexisting.tgz')
+    >>> installer._call_easy_install('setuptools', None, dest, dist)
     Traceback (most recent call last):
     ...
     UserError: Couldn't install: nonexisting.tgz



More information about the checkins mailing list