def test_not_find_wheel_not_supported(self, data, monkeypatch): """ Test not finding an unsupported wheel. """ monkeypatch.setattr( pip._internal.pep425tags, "get_supported", lambda **kw: [("py1", "none", "any")], ) req = install_req_from_line("simple.dist") finder = PackageFinder( [data.find_links], [], session=PipSession(), ) finder.valid_tags = pip._internal.pep425tags.get_supported() with pytest.raises(DistributionNotFound): finder.find_requirement(req, True)
def test_not_find_wheel_not_supported(self, data, monkeypatch): """ Test not finding an unsupported wheel. """ monkeypatch.setattr( pip._internal.pep425tags, "get_supported", lambda **kw: [("py1", "none", "any")], ) req = InstallRequirement.from_line("simple.dist") finder = PackageFinder( [data.find_links], [], session=PipSession(), ) finder.valid_tags = pip._internal.pep425tags.get_supported() with pytest.raises(DistributionNotFound): finder.find_requirement(req, True)
def test_link_sorting(self): """ Test link sorting """ links = [ InstallationCandidate("simple", "2.0", Link('simple-2.0.tar.gz')), InstallationCandidate( "simple", "1.0", Link('simple-1.0-pyT-none-TEST.whl'), ), InstallationCandidate( "simple", '1.0', Link('simple-1.0-pyT-TEST-any.whl'), ), InstallationCandidate( "simple", '1.0', Link('simple-1.0-pyT-none-any.whl'), ), InstallationCandidate( "simple", '1.0', Link('simple-1.0.tar.gz'), ), ] finder = PackageFinder([], [], session=PipSession()) finder.valid_tags = [ ('pyT', 'none', 'TEST'), ('pyT', 'TEST', 'any'), ('pyT', 'none', 'any'), ] results = sorted(links, key=finder._candidate_sort_key, reverse=True) results2 = sorted(reversed(links), key=finder._candidate_sort_key, reverse=True) assert links == results == results2, results2