def test_check_requirements_integrity_package_not_installed(in_tmpdir):
    in_tmpdir.join('requirements.txt').write('not-installed==1.0.0')
    with pytest.raises(AssertionError) as excinfo:
        main.check_requirements_integrity()
    assert excinfo.value.args == (
        'not-installed is required in requirements.txt, but is not installed',
    )
def test_check_requirements_integrity_failing(in_tmpdir):
    in_tmpdir.join('requirements.txt').write('pkg-with-deps==1.0.0')
    with pytest.raises(AssertionError) as excinfo:
        main.check_requirements_integrity()
    assert excinfo.value.args == (
        'Installed requirements do not match requirement files!\n'
        'Rebuild your virtualenv:\n'
        ' - (requirements.txt) pkg-with-deps==1.0.0 '
        '(installed) pkg-with-deps==0.1.0\n', )
def test_check_requirements_integrity_post_version(in_tmpdir, version):
    in_tmpdir.join('requirements.txt').write('chameleon=={}'.format(version))
    main.check_requirements_integrity()
def test_check_integrity_no_files(in_tmpdir):
    with pytest.raises(AssertionError) as excinfo:
        main.check_requirements_integrity()
    assert excinfo.value.args == (
        'check-requirements expects at least requirements-minimal.txt '
        'and requirements.txt', )
def test_check_requirements_integrity_doesnt_care_about_unpinned(in_tmpdir):
    in_tmpdir.join('requirements.txt').write('pkg-with-deps')
    main.check_requirements_integrity()
def test_check_requirements_integrity_passing(in_tmpdir):
    in_tmpdir.join('requirements.txt').write('pkg-with-deps==0.1.0')
    main.check_requirements_integrity()