#NEWLINE# def test_links_priority( self ) : #NEWLINE# #INDENT# '\n        Download links from the pypi simple index should be used before\n        external download links.\n        https://bitbucket.org/tarek/distribute/issue/163\n\n        Usecase :\n        - someone uploads a package on pypi, a md5 is generated\n        - someone manually copies this link (with the md5 in the url) onto an\n          external page accessible from the package page.\n        - someone reuploads the package (with a different md5)\n        - while easy_installing, an MD5 error occurs because the external link\n          is used\n        -> Setuptools should use the link from pypi, not the external one.\n        ' #NEWLINE# if sys . platform . startswith ( 'java' ) : #NEWLINE# #INDENT# return #NEWLINE# #UNINDENT# server = IndexServer ( ) #NEWLINE# server . start ( ) #NEWLINE# index_url = ( server . base_url ( ) + 'test_links_priority/simple/' ) #NEWLINE# pi = setuptools . package_index . PackageIndex ( index_url ) #NEWLINE# requirement = pkg_resources . Requirement . parse ( 'foobar' ) #NEWLINE# pi . find_packages ( requirement ) #NEWLINE# server . stop ( ) #NEWLINE# self . assertTrue ( ( 'foobar' in pi ) ) #NEWLINE# self . assertTrue ( ( len ( self [ 'foobar' ] ) == 1 ) ) #NEWLINE# self . assertTrue ( ( 'correct_md5' in pi [ 'foobar' ] [ 0 ] . location ) )