def test_parse_python_requires_unexpected_dot_star(fix_max_python_3_version, capsys, op): fix_max_python_3_version(7) assert parse_python_requires(f'{op} 3.6.*') is None assert ( f'Bad python_requires specifier: {op} 3.6.* ({op} does not allow a .*)' in capsys.readouterr().err)
def test_compute_python_requires(versions, expected, fix_max_python_3_version): fix_max_python_3_version(7) result = compute_python_requires(v(versions)) assert result == expected assert parse_python_requires(result) == v(versions)
def test_parse_python_requires_syntax_errors(capsys, specifier): assert parse_python_requires(specifier) is None assert (f'Bad python_requires specifier: {specifier}' in capsys.readouterr().err)
def test_parse_python_requires_arbitrary_version(constraint, result): assert parse_python_requires(constraint) == v(result)
def test_parse_python_requires_multiple_greater_than(fix_max_python_3_version): fix_max_python_3_version(7) assert parse_python_requires('>= 2.7, >= 3.6') == v(['3.6', '3.7'])
def test_parse_python_requires_exclusive_ordering(constraint, result): assert parse_python_requires(constraint) == v(result)
def test_parse_python_requires_greater_than_with_exceptions( fix_max_python_3_version, constraint, result): fix_max_python_3_version(3) assert parse_python_requires(constraint) == v(result)
def test_parse_python_requires_greater_than(fix_max_python_3_version): fix_max_python_3_version(8) assert parse_python_requires('>= 3.6') == v(['3.6', '3.7', '3.8'])
def test_parse_python_requires_matching_version(constraint, result): assert parse_python_requires(constraint) == v(result)
def test_parse_python_requires_approximately_not_enough_dots(capsys): assert parse_python_requires('~= 2') is None assert ('Bad python_requires specifier: ~= 2' ' (~= requires a version with at least one dot)' in capsys.readouterr().err)
def test_parse_python_requires_approximately(constraint, result): assert parse_python_requires(constraint) == v(result)