[Checkins] SVN: zc.buildout/branches/reinout_distribute_upgrade_check/src/zc/buildout/easy_install.txt Added test for distribute easy_install corner case.
Reinout van Rees
reinout at vanrees.org
Thu Nov 5 09:33:18 EST 2009
Log message for revision 105497:
Added test for distribute easy_install corner case.
Sadly quite an internals-testing test.
Changed:
U zc.buildout/branches/reinout_distribute_upgrade_check/src/zc/buildout/easy_install.txt
-=-
Modified: zc.buildout/branches/reinout_distribute_upgrade_check/src/zc/buildout/easy_install.txt
===================================================================
--- zc.buildout/branches/reinout_distribute_upgrade_check/src/zc/buildout/easy_install.txt 2009-11-05 14:00:01 UTC (rev 105496)
+++ zc.buildout/branches/reinout_distribute_upgrade_check/src/zc/buildout/easy_install.txt 2009-11-05 14:33:18 UTC (rev 105497)
@@ -1328,3 +1328,40 @@
>>> zc.buildout.easy_install.install_from_cache(False)
True
+
+Installing setuptools/distribute
+--------------------------------
+
+Setuptools (0.6something) is packaged as an ``.egg``. So when installing it,
+the egg is downloaded and used. Distribute is packaged as a tarball, which
+makes an easy_install call necessary. In older versions of buildout, the
+``_call_easy_install()`` method would call ``_get_dist()`` to get hold of the
+setuptools path for calling easy_install. When an updated "distribute" was
+found, this would try an install again, leading to an infinite recursion.
+
+The solution is to just use the setuptools location found at import time, like
+happens with the buildout and setuptools location that is inserted in scripts'
+paths.
+
+We test this corner case by patching the ``_get_dist()`` call:
+
+ >>> def mock_get_dist(requirement, ws, always_unzip):
+ ... raise RuntimeError("We should not get called")
+
+When installing setuptools itself, we expect the "Getting dist" message not to
+be printed. We call ``_call_easy_install()`` directly and get an error
+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:
+
+ >>> installer = zc.buildout.easy_install.Installer(
+ ... dest=dest,
+ ... links=[link_server],
+ ... index=link_server+'index/',
+ ... executable=sys.executable,
+ ... always_unzip=True)
+ >>> installer._get_dist = mock_get_dist
+ >>> installer._call_easy_install('setuptools', None, dest,
+ ... 'nonexisting.tgz')
+ Traceback (most recent call last):
+ ...
+ UserError: Couldn't install: nonexisting.tgz
More information about the checkins
mailing list