def test_evaluate_link__match(self, url, expected_version): """Test that 'pytest' archives match for 'pytest'""" link = Link(url) search = Search( supplied=self.search_name, canonical=self.canonical_name, formats=['source', 'binary'], ) actual = self.evaluator.evaluate_link(link, search) assert actual == (True, expected_version)
def test_evaluate_link__substring_fails(self, url): """Test that 'pytest<something> archives won't match for 'pytest'.""" link = Link(url) search = Search( supplied=self.search_name, canonical=self.canonical_name, formats=['source', 'binary'], ) result = self.evaluator.get_install_candidate(link, search) assert result is None, result
def test_evaluate_link__substring_fails(self, url, expected_msg): """Test that 'pytest<something> archives won't match for 'pytest'.""" link = Link(url) search = Search( supplied=self.search_name, canonical=self.canonical_name, formats=['source', 'binary'], ) actual = self.evaluator.evaluate_link(link, search) assert actual == (False, expected_msg)
def est_link_package_versions_substring_fails(self, url): """Test that 'pytest<something> archives won't match for 'pytest'.""" link = Link(url) search = Search( supplied=self.search_name, canonical=self.canonical_name, formats=['source', 'binary'], ) result = self.finder._link_package_versions(link, search) assert result is None, result
def test_evaluate_link__match(self, url): """Test that 'pytest' archives match for 'pytest'""" link = Link(url) search = Search( supplied=self.search_name, canonical=self.canonical_name, formats=['source', 'binary'], ) result = self.evaluator.get_install_candidate(link, search) expected = InstallationCandidate(self.search_name, self.version, link) assert result == expected, result
def test_link_package_versions_match(self, url): """Test that 'pytest' archives match for 'pytest'""" link = Link(url) search = Search( supplied=self.search_name, canonical=self.canonical_name, formats=['source', 'binary'], ) result = self.finder._link_package_versions(link, search) expected = InstallationCandidate(self.search_name, self.version, link) assert result == expected, result
def test_evaluate_link__allow_yanked( self, yanked_reason, allow_yanked, expected, ): evaluator = CandidateEvaluator(allow_yanked=allow_yanked) link = Link( 'https://example.com/#egg=twine-1.12', yanked_reason=yanked_reason, ) search = Search( supplied='twine', canonical='twine', formats=['source'], ) actual = evaluator.evaluate_link(link, search=search) assert actual == expected
def test_evaluate_link__incompatible_wheel(self): """ Test an incompatible wheel. """ target_python = TargetPython(py_version_info=(3, 6, 4)) # Set the valid tags to an empty list to make sure nothing matches. target_python._valid_tags = [] evaluator = CandidateEvaluator(target_python=target_python) link = Link('https://example.com/sample-1.0-py2.py3-none-any.whl') search = Search( supplied='sample', canonical='sample', formats=['binary'], ) actual = evaluator.evaluate_link(link, search=search) expected = ( False, "none of the wheel's tags match: py2-none-any, py3-none-any") assert actual == expected
def test_evaluate_link( self, py_version_info, ignore_requires_python, expected, ): link = Link( 'https://example.com/#egg=twine-1.12', requires_python='== 3.6.5', ) search = Search( supplied='twine', canonical='twine', formats=['source'], ) evaluator = CandidateEvaluator( [], py_version_info=py_version_info, ignore_requires_python=ignore_requires_python, ) actual = evaluator.evaluate_link(link, search=search) assert actual == expected