def test_parse_python_requires_unexpected_dot_star(monkeypatch, capsys, op): monkeypatch.setattr(cpv, 'CURRENT_PYTHON_3_VERSION', 7) assert cpv.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_parse_python_requires_approximately_not_enough_dots(capsys): assert cpv.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_syntax_errors(capsys, specifier): assert cpv.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 cpv.parse_python_requires(constraint) == result
def test_parse_python_exclusive_ordering(constraint, result): assert cpv.parse_python_requires(constraint) == result
def test_parse_python_requires_multiple_greater_than(monkeypatch): monkeypatch.setattr(cpv, 'CURRENT_PYTHON_3_VERSION', 7) assert cpv.parse_python_requires('>= 2.7, >= 3.6') == ['3.6', '3.7']
def test_parse_python_requires_greater_than_with_exceptions( monkeypatch, constraint, result ): monkeypatch.setattr(cpv, 'CURRENT_PYTHON_3_VERSION', 3) assert cpv.parse_python_requires(constraint) == result
def test_parse_python_requires_matching_version(constraint, result): assert cpv.parse_python_requires(constraint) == result
def test_parse_python_requires_approximately(constraint, result): assert cpv.parse_python_requires(constraint) == result