def test_evaluate_link__allow_yanked( self, yanked_reason, allow_yanked, expected, ): target_python = TargetPython(py_version_info=(3, 6, 4)) evaluator = LinkEvaluator( project_name='twine', canonical_name='twine', formats={'source'}, target_python=target_python, allow_yanked=allow_yanked, ) link = Link( 'https://example.com/#egg=twine-1.12', yanked_reason=yanked_reason, ) actual = evaluator.evaluate_link(link) assert actual == expected
def make_test_link_evaluator(self, formats): target_python = TargetPython() return LinkEvaluator( project_name='pytest', canonical_name='pytest', formats=formats, target_python=target_python, allow_yanked=True, )
def test_evaluate_link( self, py_version_info, ignore_requires_python, expected, ): target_python = TargetPython(py_version_info=py_version_info) evaluator = LinkEvaluator( project_name='twine', canonical_name='twine', formats={'source'}, target_python=target_python, allow_yanked=True, ignore_requires_python=ignore_requires_python, ) link = Link( 'https://example.com/#egg=twine-1.12', requires_python='== 3.6.5', ) actual = evaluator.evaluate_link(link) 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 = LinkEvaluator( project_name='sample', canonical_name='sample', formats={'binary'}, target_python=target_python, allow_yanked=True, ) link = Link('https://example.com/sample-1.0-py2.py3-none-any.whl') actual = evaluator.evaluate_link(link) expected = ( False, "none of the wheel's tags match: py2-none-any, py3-none-any") assert actual == expected