def test_process_project_url(data): project_name = 'simple' index_url = data.index_url('simple') project_url = Link(f'{index_url}/{project_name}') finder = make_test_finder(index_urls=[index_url]) link_evaluator = finder.make_link_evaluator(project_name) actual = finder.process_project_url( project_url, link_evaluator=link_evaluator, ) assert len(actual) == 1 package_link = actual[0] assert package_link.name == 'simple' assert str(package_link.version) == '1.0'
def test_process_project_url(data: TestData) -> None: project_name = "simple" index_url = data.index_url("simple") project_url = Link(f"{index_url}/{project_name}") finder = make_test_finder(index_urls=[index_url]) link_evaluator = finder.make_link_evaluator(project_name) actual = finder.process_project_url( project_url, link_evaluator=link_evaluator, ) assert len(actual) == 1 package_link = actual[0] assert package_link.name == "simple" assert str(package_link.version) == "1.0"
def test_link_sorting_wheels_with_build_tags(self): """Verify build tags affect sorting.""" links = [ InstallationCandidate( "simplewheel", "2.0", Link("simplewheel-2.0-1-py2.py3-none-any.whl"), ), InstallationCandidate( "simplewheel", "2.0", Link("simplewheel-2.0-py2.py3-none-any.whl"), ), InstallationCandidate( "simplewheel", "1.0", Link("simplewheel-1.0-py2.py3-none-any.whl"), ), ] candidate_evaluator = CandidateEvaluator.create('my-project') sort_key = candidate_evaluator._sort_key results = sorted(links, key=sort_key, reverse=True) results2 = sorted(reversed(links), key=sort_key, reverse=True) assert links == results == results2, results2
def test_evaluate_link__substring_fails(self, url, expected_msg): """Test that 'pytest<something> archives won't match for 'pytest'.""" link = Link(url) evaluator = self.make_test_link_evaluator(formats=['source', 'binary']) actual = evaluator.evaluate_link(link) assert actual == (False, expected_msg)
def test_evaluate_link__match(self, url, expected_version): """Test that 'pytest' archives match for 'pytest'""" link = Link(url) evaluator = self.make_test_link_evaluator(formats=['source', 'binary']) actual = evaluator.evaluate_link(link) assert actual == (True, expected_version)
def test_evaluate_link__match(self, url: str, expected_version: str) -> None: """Test that 'pytest' archives match for 'pytest'""" link = Link(url) evaluator = self.make_test_link_evaluator(formats=["source", "binary"]) actual = evaluator.evaluate_link(link) assert actual == (True, expected_version)