コード例 #1
0
def test_install_add_options_after_last_hyphen_requirement(
        tmpdir, mock_pip, config_file, snapshot):
    requirements_file = tmpdir.join('requirements.txt')
    requirements_file.write('--no-index\n-f https://find.links\n')

    invoke_cli('install a --extra-index-url https://new.last', config_file)
    check_requirements_snapshot(tmpdir, snapshot)
コード例 #2
0
def test_install_add_options_after_multiline(tmpdir, mock_pip, config_file,
                                             snapshot):
    requirements_file = tmpdir.join('requirements.txt')
    requirements_file.write('--no-index\\\nmultiline\n')

    invoke_cli('install a --extra-index-url https://index.url', config_file)
    check_requirements_snapshot(tmpdir, snapshot)
コード例 #3
0
def test_install_add_requirement_after_multiline(tmpdir, mock_pip, config_file,
                                                 snapshot):
    requirements_file = tmpdir.join('requirements.txt')
    requirements_file.write('a==1.0 --hash=abc\\\n--hash=abc')

    invoke_cli('install b', config_file)
    check_requirements_snapshot(tmpdir, snapshot)
コード例 #4
0
def test_install_add_editables_with_blank_lines(tmpdir, mock_pip,
                                                mock_pkg_dist_not_found,
                                                config_file, snapshot):
    requirements_file = tmpdir.join('requirements.txt')
    requirements_file.write('-r common.txt\n\n--no-index\n')
    invoke_cli('install -e editable1', config_file)
    check_requirements_snapshot(tmpdir, snapshot)
コード例 #5
0
def test_install_keep_comments(tmpdir, mock_pip, config_file, snapshot):
    requirements_file = tmpdir.join('requirements.txt')
    requirements_file.write(
        'a # Comment\n# Comment\nc==1.0.0\nd~=0.1.0 --hash=abc # Comment')

    invoke_cli('install a b d', config_file)
    check_requirements_snapshot(tmpdir, snapshot)
コード例 #6
0
def test_install_add_requirement_with_global_option(tmpdir, mock_pip,
                                                    config_file, snapshot):
    requirements_file = tmpdir.join('requirements.txt')
    invoke_cli(
        'install a --global-option "--override-pip" --global-option "--another"',
        config_file)
    check_requirements_snapshot(tmpdir, snapshot)
コード例 #7
0
ファイル: test_uninstall.py プロジェクト: danielzk/pipw
def test_uninstall_not_remove_if_no_save(tmpdir, mock_pip, config_file,
                                         snapshot):
    requirements_file = tmpdir.join('requirements.txt')
    requirements_file.write('a==1.0.0\nb==1.0.0')

    invoke_cli('uninstall a b --no-save', config_file)
    check_requirements_snapshot(tmpdir, snapshot)
コード例 #8
0
ファイル: test_uninstall.py プロジェクト: danielzk/pipw
def test_uninstall(tmpdir, mock_pip, config_file, snapshot):
    requirements_file = tmpdir.join('requirements.txt')
    requirements_file.write(
        '-e editable1\nold1\na~=1.0.0\nold2~=1.0.0 --hash=anc\\\n--hash=abc\nb'
    )

    invoke_cli('uninstall old1 old2', config_file)
    check_requirements_snapshot(tmpdir, snapshot)
コード例 #9
0
def test_install_skip_requirements_argument(tmpdir, mock_pip, config_file,
                                            snapshot):
    invoke_cli('install -r test.txt', config_file)
    requirements_exists = tmpdir.join('requirements.txt').check()
    assert not requirements_exists

    invoke_cli('install a --requirements test.txt', config_file)
    check_requirements_snapshot(tmpdir, snapshot)
コード例 #10
0
def test_install_add_options_before_editables(tmpdir, mock_pip, config_file,
                                              snapshot):
    requirements_file = tmpdir.join('requirements.txt')
    requirements_file.write(
        '--no-index\\\nmultiline\n-f https://find.links\n-e editable1')

    invoke_cli('install a --extra-index-url https://index.url', config_file)
    check_requirements_snapshot(tmpdir, snapshot)
コード例 #11
0
def test_install_add_editables_after_last_hyphen_requirement(
        tmpdir, mock_pip, mock_pkg_dist_not_found, config_file, snapshot):
    requirements_file = tmpdir.join('requirements.txt')
    requirements_file.write('a==1.0 --hash=abc\\\n--hash=abc')
    invoke_cli('install -e editable1', config_file)
    invoke_cli('install b', config_file)
    invoke_cli('install --editable editable2', config_file)
    check_requirements_snapshot(tmpdir, snapshot)
コード例 #12
0
def test_install_add_editables_after_multiline(tmpdir, mock_pip,
                                               mock_pkg_dist_not_found,
                                               config_file, snapshot):
    requirements_file = tmpdir.join('requirements.txt')
    requirements_file.write('-e editable1\\\nmultiline\n')

    invoke_cli('install -e editable2 a', config_file)
    check_requirements_snapshot(tmpdir, snapshot)
コード例 #13
0
def test_install_keep_options(tmpdir, mock_pip, config_file, snapshot):
    requirements_file = tmpdir.join('requirements.txt')
    requirements_file.write(
        'a --hash=abc\nb==0.0.1 --hash=abc --hash=abc\nc >= 1.1, == 1.* --hash=abc'
    )

    invoke_cli('install a b c==3.0.0', config_file)
    check_requirements_snapshot(tmpdir, snapshot)
コード例 #14
0
def test_install_update_requirements_with_hyphen(monkeypatch, tmpdir, mock_pip,
                                                 config_file, snapshot):
    requirements_file = tmpdir.join('requirements.txt')
    requirements_file.write('a\nreq-hyp==1.0.0')

    monkeypatch.setattr(
        'pkg_resources.get_distribution',
        lambda package: PkgDistributionFactory(version='2.0.0'))
    invoke_cli('install a b c', config_file)
    check_requirements_snapshot(tmpdir, snapshot)
コード例 #15
0
def test_install_update_requirements_with_different_letter_case(
        monkeypatch, tmpdir, mock_pip, config_file, snapshot):
    requirements_file = tmpdir.join('requirements.txt')
    requirements_file.write('Django==1.0.0\nmylib')

    monkeypatch.setattr(
        'pkg_resources.get_distribution',
        lambda package: PkgDistributionFactory(version='2.0.0'))
    invoke_cli('install django Mylib', config_file)
    check_requirements_snapshot(tmpdir, snapshot)
コード例 #16
0
ファイル: test_uninstall.py プロジェクト: danielzk/pipw
def test_uninstall_remove_from_all_envs(tmpdir, mock_pip, snapshot):
    paths = {
        'requirements': tmpdir.join('dev.txt'),
        'dev': tmpdir.join('dev.txt'),
        'test': tmpdir.join('test.txt'),
    }
    config = config_file(
        tmpdir, {
            'requirements': paths['requirements'].strpath,
            'envs':
            {k: v.strpath
             for k, v in paths.items() if k != 'requirements'},
        })

    for path in paths.values():
        path.write('old==1.0.0\na==1.0.0')

    invoke_cli('uninstall old', config)

    for path in paths.values():
        check_requirements_snapshot(tmpdir, snapshot, path)
コード例 #17
0
def test_install_add_requirement_with_specified_version(
        tmpdir, mock_pip, config_file, snapshot):
    invoke_cli('install mylib==3.0.5', config_file)
    check_requirements_snapshot(tmpdir, snapshot)
コード例 #18
0
def test_install_options_keep_comments(tmpdir, mock_pip, config_file,
                                       snapshot):
    requirements_file = tmpdir.join('requirements.txt')
    requirements_file.write('--index-url https://index.url # Comment')
    invoke_cli('install a --index-url https://index.url2', config_file)
    check_requirements_snapshot(tmpdir, snapshot)
コード例 #19
0
def test_install_set_index_url(tmpdir, mock_pip, config_file, snapshot):
    invoke_cli('install a -i https://index.url', config_file)
    check_requirements_snapshot(tmpdir, snapshot)
    invoke_cli('install a --index-url https://index.url2', config_file)
    check_requirements_snapshot(tmpdir, snapshot)
コード例 #20
0
def test_install_update_requirement_with_specified_version(
        tmpdir, mock_pip, config_file, snapshot):
    requirements_file = tmpdir.join('requirements.txt')
    requirements_file.write('a >= 1.1, == 1.*')
    invoke_cli('install a>=3.0.0', config_file)
    check_requirements_snapshot(tmpdir, snapshot)
コード例 #21
0
def test_install_add_requirements(tmpdir, mock_pip, config_file, snapshot):
    invoke_cli('install a b', config_file)
    check_requirements_snapshot(tmpdir, snapshot)
コード例 #22
0
def test_install_not_repeat_extra_index_url(tmpdir, mock_pip, config_file,
                                            snapshot):
    invoke_cli('install a --extra-index-url https://index.url', config_file)
    invoke_cli('install a --extra-index-url https://index.url', config_file)
    check_requirements_snapshot(tmpdir, snapshot)
コード例 #23
0
def test_install_not_repeat_no_index(tmpdir, mock_pip, config_file, snapshot):
    invoke_cli('install a --no-index', config_file)
    invoke_cli('install a --no-index', config_file)
    check_requirements_snapshot(tmpdir, snapshot)
コード例 #24
0
def test_install_add_requirements_after_last_hyphen_with_blank_lines(
        tmpdir, mock_pip, config_file, snapshot):
    requirements_file = tmpdir.join('requirements.txt')
    requirements_file.write('-r common.txt\n\na\n--no-index\n')
    invoke_cli('install a b c', config_file)
    check_requirements_snapshot(tmpdir, snapshot)
コード例 #25
0
def test_install_not_repeat_find_links(tmpdir, mock_pip, config_file,
                                       snapshot):
    invoke_cli('install a --find-links https://find.links', config_file)
    invoke_cli('install a --find-links https://find.links', config_file)
    check_requirements_snapshot(tmpdir, snapshot)
コード例 #26
0
def test_install_add_requirements_after_last_hyphen_requirement(
        tmpdir, mock_pip, config_file, snapshot):
    requirements_file = tmpdir.join('requirements.txt')
    requirements_file.write('-r common.txt\n-e editable1')
    invoke_cli('install a b', config_file)
    check_requirements_snapshot(tmpdir, snapshot)
コード例 #27
0
def test_no_detect_version(tmpdir, mock_pip, config_file, snapshot):
    invoke_cli('install a b==3.2.0 --no-detect-version', config_file)
    check_requirements_snapshot(tmpdir, snapshot)
コード例 #28
0
def test_install_update_requirement_with_install_option(
        tmpdir, mock_pip, config_file, snapshot):
    requirements_file = tmpdir.join('requirements.txt')
    requirements_file.write('a~=1.0.0 --install-option="--override-pip"')
    invoke_cli('install a --install-option "--another"', config_file)
    check_requirements_snapshot(tmpdir, snapshot)
コード例 #29
0
ファイル: test_save_to.py プロジェクト: danielzk/pipw
def test_save_to(tmpdir, mock_pip, config_file, snapshot):
    requirements_path = tmpdir.join('custom.txt')
    invoke_cli('install a --save-to {}'.format(requirements_path.strpath), config_file)
    check_requirements_snapshot(tmpdir, snapshot, requirements_path)