def test_finder_priority_file_over_page(data):
 req = InstallRequirement.from_line('gmpy==1.15', None)
 finder = PackageFinder([data.find_links], ['http://pypi.python.org/simple'], session=PipSession())
 all_versions = finder.find_all_candidates(req.name)
 assert (all_versions[0].location.scheme == 'file')
 assert all(((version.location.scheme == 'https') for version in all_versions[1:])), all_versions
 link = finder.find_requirement(req, False)
 assert link.url.startswith('file://')

def test_finder_priority_file_over_page ( data ) : req = InstallRequirement . from_line ( 'gmpy==1.15' , None ) finder = PackageFinder ( [ data . find_links ] , [ 'http://pypi.python.org/simple' ] , session = PipSession ( ) ) all_versions = finder . find_all_candidates ( req . name ) assert ( all_versions [ 0 ] . location . scheme == 'file' ) assert all ( ( ( version . location . scheme == 'https' ) for version in all_versions [ 1 : ] ) ) , all_versions link = finder . find_requirement ( req , False ) assert link . url . startswith ( 'file://' )
test packagefinder prefers file links over equivalent page links .