Commit 2b57cb09 authored by Jim Fulton's avatar Jim Fulton

I don't think we need a distribute-specific update test any more

parent a18b558c
...@@ -2878,7 +2878,7 @@ def test_suite(): ...@@ -2878,7 +2878,7 @@ def test_suite():
doctest.DocFileSuite( doctest.DocFileSuite(
'easy_install.txt', 'downloadcache.txt', 'dependencylinks.txt', 'easy_install.txt', 'downloadcache.txt', 'dependencylinks.txt',
'allowhosts.txt', 'unzip.txt', 'upgrading_distribute.txt', 'allowhosts.txt', 'unzip.txt',
setUp=easy_install_SetUp, setUp=easy_install_SetUp,
tearDown=zc.buildout.testing.buildoutTearDown, tearDown=zc.buildout.testing.buildoutTearDown,
checker=renormalizing.RENormalizing([ checker=renormalizing.RENormalizing([
......
Installing distribute
---------------------
Some initial test setup:
>>> import sys
>>> import zc.buildout
>>> dest = tmpdir('sample-install')
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 distribute location found at import time, like
happens with the buildout and distribute 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 distribute 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:
>>> class MockDist(object):
... def __str__(self):
... return 'nonexisting.tgz'
... @property
... def project_name(self):
... # Testing corner case: there *is* actually
... # a newer distribute 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],
... index=link_server+'index/',
... always_unzip=True)
>>> installer._get_dist = mock_get_dist
>>> installer._call_easy_install('distribute', None, dest, dist)
Traceback (most recent call last):
...
UserError: Couldn't install: nonexisting.tgz
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment