def test_check_link_requires_python__invalid_requires(caplog): """ Test the log message for an invalid Requires-Python. """ link = Link('https://example.com', requires_python='invalid') caplog.set_level(logging.DEBUG) actual = _check_link_requires_python(link, version_info=(3, 6, 5)) assert actual expected_message = ( "Ignoring invalid Requires-Python ('invalid') for link: " "https://example.com") check_caplog(caplog, 'DEBUG', expected_message)
def test_check_link_requires_python__incompatible_python( caplog, ignore_requires_python, expected, ): """ Test an incompatible Python. """ expected_return, expected_level, expected_message = expected link = Link('https://example.com', requires_python='== 3.6.4') caplog.set_level(logging.DEBUG) actual = _check_link_requires_python( link, version_info=(3, 6, 5), ignore_requires_python=ignore_requires_python, ) assert actual == expected_return check_caplog(caplog, expected_level, expected_message)
def test_check_link_requires_python(requires_python, expected): version_info = (3, 6, 5) link = Link('https://example.com', requires_python=requires_python) actual = _check_link_requires_python(link, version_info) assert actual == expected