diff options
author | Ronny Pfannschmidt <Ronny.Pfannschmidt@gmx.de> | 2010-05-25 18:39:05 +0200 |
---|---|---|
committer | Ronny Pfannschmidt <Ronny.Pfannschmidt@gmx.de> | 2010-05-25 18:39:05 +0200 |
commit | bacf36252a50b1ad1347955d5a6c33e571d2c8cf (patch) | |
tree | 3449925ad3df907737bcb4eb843933c58fd1f23f /setuptools/tests/test_packageindex.py | |
parent | 9456da484efba996b190310fa39dca7db2c8ea81 (diff) | |
parent | 0756b06fcfc6bb9c045c6927605d1165cd7000cb (diff) | |
download | external_python_setuptools-bacf36252a50b1ad1347955d5a6c33e571d2c8cf.tar.gz external_python_setuptools-bacf36252a50b1ad1347955d5a6c33e571d2c8cf.tar.bz2 external_python_setuptools-bacf36252a50b1ad1347955d5a6c33e571d2c8cf.zip |
merge
--HG--
branch : distribute
extra : rebase_source : 5fbe57fd3b9bb48afcc78a87a7f7a46d9f4d2567
Diffstat (limited to 'setuptools/tests/test_packageindex.py')
-rw-r--r-- | setuptools/tests/test_packageindex.py | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/setuptools/tests/test_packageindex.py b/setuptools/tests/test_packageindex.py index 8ae7a5b9..42cb8c1e 100644 --- a/setuptools/tests/test_packageindex.py +++ b/setuptools/tests/test_packageindex.py @@ -5,6 +5,7 @@ import sys import os, shutil, tempfile, unittest, urllib2 import pkg_resources import setuptools.package_index +from server import IndexServer class TestPackageIndex(unittest.TestCase): @@ -74,3 +75,38 @@ class TestPackageIndex(unittest.TestCase): url = 'file:///tmp/test_package_index' self.assert_(index.url_ok(url, True)) + def test_links_priority(self): + """ + Download links from the pypi simple index should be used before + external download links. + http://bitbucket.org/tarek/distribute/issue/163/md5-validation-error + + Usecase : + - someone uploads a package on pypi, a md5 is generated + - someone manually copies this link (with the md5 in the url) onto an + external page accessible from the package page. + - someone reuploads the package (with a different md5) + - while easy_installing, an MD5 error occurs because the external link + is used + -> Distribute should use the link from pypi, not the external one. + """ + # start an index server + server = IndexServer() + server.start() + index_url = server.base_url() + 'test_links_priority/simple/' + + # scan a test index + pi = setuptools.package_index.PackageIndex(index_url) + requirement = pkg_resources.Requirement.parse('foobar') + pi.find_packages(requirement) + server.stop() + + # the distribution has been found + self.assert_('foobar' in pi) + # we have only one link, because links are compared without md5 + self.assert_(len(pi['foobar'])==1) + # the link should be from the index + self.assert_('correct_md5' in pi['foobar'][0].location) + + + |