Beispiel #1
0
def it_installs_stuff(tmpdir):
    venv = tmpdir.join('venv')
    install_coverage(venv)

    assert pip_freeze(str(venv)) == '''\
appdirs==1.4.0
coverage==4.3.4
coverage-enable-subprocess==1.0
packaging==16.8
pip==9.0.1
pyparsing==2.1.10
setuptools==34.1.1
six==1.10.0
wheel==0.29.0
'''

    pip = venv.join('bin/pip').strpath
    run(pip, 'install', 'venv-update==' + __version__)

    assert [req.split('==')[0] for req in pip_freeze(str(venv)).split()] == [
        'appdirs',
        'coverage',
        'coverage-enable-subprocess',
        'packaging',
        'pip',
        'pyparsing',
        'setuptools',
        'six',
        'venv-update',
        'wheel',
    ]

    run(str(venv.join('bin/pip-faster')), 'install', 'pure_python_package')

    assert 'pure-python-package==0.2.1' in pip_freeze(str(venv)).split('\n')
Beispiel #2
0
def it_doesnt_wheel_git_repos(tmpdir):
    venv = tmpdir.join('venv')
    install_coverage(venv)

    pip = venv.join('bin/pip').strpath
    run(pip, 'install', 'venv-update==' + __version__)

    run(
        venv.join('bin/pip-faster').strpath,
        'install',
        'git+git://github.com/Yelp/dumb-init.git@87545be699a13d0fd31f67199b7782ebd446437e#egg=dumb-init',  # noqa
    )

    frozen_requirements = pip_freeze(str(venv)).split('\n')
    assert set(frozen_requirements) == set([
        'appdirs==1.4.0',
        'coverage-enable-subprocess==1.0',
        'coverage==4.3.4',
        'dumb-init==0.5.0',
        'packaging==16.8',
        'pip==9.0.1',
        'pyparsing==2.1.10',
        'setuptools==34.1.1',
        'six==1.10.0',
        'venv-update==' + __version__,
        'wheel==0.29.0',
        '',
    ])

    assert not tuple(cached_wheels(tmpdir))
Beispiel #3
0
def it_doesnt_wheel_local_dirs(tmpdir):
    venv = tmpdir.join('venv')
    install_coverage(venv)

    pip = venv.join('bin/pip').strpath
    run(pip, 'install', 'venv-update==' + __version__)

    run(
        venv.join('bin/pip-faster').strpath,
        'install',
        TOP.join('tests/testing/packages/dependant_package').strpath,
    )

    frozen_requirements = pip_freeze(str(venv)).split('\n')
    assert set(frozen_requirements) == {
        'coverage==ANY',
        'coverage-enable-subprocess==1.0',
        'dependant-package==1',
        'implicit-dependency==1',
        'many-versions-package==3',
        'pure-python-package==0.2.1',
        'venv-update==' + __version__,
        '',
    }

    assert {wheel.name for wheel in cached_wheels(tmpdir)} == {
        'implicit-dependency',
        'many-versions-package',
        'pure-python-package',
    }
Beispiel #4
0
def test_cant_wheel_package(tmpdir):
    with tmpdir.as_cwd():
        enable_coverage()
        install_coverage()
        requirements('cant-wheel-package\npure-python-package')

        out, err = venv_update()
        err = strip_pip_warnings(err)
        assert err == ''

        out = uncolor(out)

        # for unknown reasons, py27 has an extra line with four spaces in this output, where py26 does not.
        out = out.replace('\n    \n', '\n')
        assert '''

----------------------------------------
Failed building wheel for cant-wheel-package
Running setup.py bdist_wheel for pure-python-package
Destination directory: %s/home/.cache/pip-faster/wheelhouse''' % tmpdir + '''
SLOW!! no wheel found after building (couldn't be wheeled?): cant-wheel-package==0.1.0
Installing collected packages: cant-wheel-package, pure-python-package
  Running setup.py install for cant-wheel-package
  Could not find .egg-info directory in install record for cant-wheel-package (from -r requirements.txt (line 1))
Successfully installed cant-wheel-package pure-python-package
Cleaning up...
''' in out  # noqa
        assert pip_freeze().startswith('cant-wheel-package==0.1.0\n')
Beispiel #5
0
def it_can_handle_a_bad_findlink(tmpdir):
    venv = tmpdir.join('venv')
    install_coverage(venv)

    pip = venv.join('bin/pip').strpath
    run(pip, 'install', 'venv-update==' + __version__)

    out, err = run(
        str(venv.join('bin/pip-faster')),
        'install', '-vvv',
        '--find-links', 'git+wat://not/a/thing',
        'pure-python-package',
    )
    out = uncolor(out)
    err = strip_pip_warnings(err)

    expected = '''\
Successfully built pure-python-package
Installing collected packages: pure-python-package
'''
    assert expected in out
    # Between this there's:
    # 'changing mode of .../venv/bin/pure-python-script to 775'
    # but that depends on umask
    _, rest = out.split(expected)
    expected2 = '''\
Successfully installed pure-python-package-0.2.1
Cleaning up...
'''
    assert expected2 in rest
    assert err == (
        "  Url 'git+wat://not/a/thing' is ignored. "
        'It is either a non-existing path or lacks a specific scheme.\n'
    )
    assert 'pure-python-package==0.2.1' in pip_freeze(str(venv)).split('\n')
Beispiel #6
0
def it_installs_stuff_with_dash_e_without_wheeling(tmpdir):
    venv = tmpdir.join('venv')
    install_coverage(venv)

    pip = venv.join('bin/pip').strpath
    run(pip, 'install', 'venv-update==' + __version__)

    # Install a package from git with no extra dependencies in editable mode.
    #
    # We need to install a package from VCS instead of the filesystem because
    # otherwise we aren't testing that editable requirements aren't wheeled
    # (and instead might just be testing that local paths aren't wheeled).
    requirements('-e git+git://github.com/Yelp/dumb-init.git@87545be699a13d0fd31f67199b7782ebd446437e#egg=dumb-init')  # noqa

    run(str(venv.join('bin/pip-faster')), 'install', '-r', 'requirements.txt')

    frozen_requirements = pip_freeze(str(venv)).split('\n')
    assert set(frozen_requirements) == {
        '-e git://github.com/Yelp/dumb-init.git@87545be699a13d0fd31f67199b7782ebd446437e#egg=dumb_init',  # noqa
        'coverage-enable-subprocess==1.0',
        'coverage==ANY',
        'venv-update==' + __version__,
        '',
    }

    # we shouldn't wheel things installed editable
    assert not tuple(cached_wheels(tmpdir))
Beispiel #7
0
def test_no_conflicts_when_no_deps_specified(tmpdir):
    venv = tmpdir.join('venv')
    install_coverage(venv)

    pip = venv.join('bin/pip').strpath
    run(pip, 'install', 'venv-update==' + __version__)

    pkgdir = tmpdir.join('pkgdir').ensure_dir()
    setup_py = pkgdir.join('setup.py')

    def _setup_py(many_versions_package_version):
        setup_py.write(
            'from setuptools import setup\n'
            'setup(\n'
            '    name="pkg",\n'
            '    install_requires=["many-versions-package=={}"],\n'
            ')\n'.format(many_versions_package_version)
        )

    cmd = (
        venv.join('bin/pip-faster').strpath, 'install', '--upgrade',
        pkgdir.strpath,
    )

    _setup_py('1')
    run(*cmd)

    _setup_py('2')
    # Should not complain about conflicts since we specified `--no-deps`
    run(*cmd + ('--no-deps',))
Beispiel #8
0
def it_can_handle_a_bad_findlink(tmpdir):
    venv = tmpdir.join('venv')
    install_coverage(venv)

    pip = venv.join('bin/pip').strpath
    run(pip, 'install', 'venv-update==' + __version__)

    out, err = run(
        str(venv.join('bin/pip-faster')),
        'install',
        '-vvv',
        '--find-links',
        'git+wat://not/a/thing',
        'pure-python-package',
    )
    out = uncolor(out)
    err = strip_pip_warnings(err)

    expected = '''\
Successfully built pure-python-package
Installing collected packages: pure-python-package
'''
    assert expected in out
    # Between this there's:
    # 'changing mode of .../venv/bin/pure-python-script to 775'
    # but that depends on umask
    _, rest = out.split(expected)
    expected2 = '''\
Successfully installed pure-python-package-0.2.1
Cleaning up...
'''
    assert expected2 in rest
    assert "Url 'git+wat://not/a/thing' is ignored." in err
    assert 'pure-python-package==0.2.1' in pip_freeze(str(venv)).split('\n')
Beispiel #9
0
def it_doesnt_wheel_local_dirs(tmpdir):
    venv = tmpdir.join('venv')
    install_coverage(venv)

    pip = venv.join('bin/pip').strpath
    run(pip, 'install', 'venv-update==' + __version__)

    run(
        venv.join('bin/pip-faster').strpath,
        'install',
        TOP.join('tests/testing/packages/dependant_package').strpath,
    )

    frozen_requirements = pip_freeze(str(venv)).split('\n')
    assert set(frozen_requirements) == {
        'coverage==ANY',
        'coverage-enable-subprocess==1.0',
        'dependant-package==1',
        'implicit-dependency==1',
        'many-versions-package==3',
        'pure-python-package==0.2.1',
        'venv-update==' + __version__,
        '',
    }

    assert {wheel.name
            for wheel in cached_wheels(tmpdir)} == {
                'implicit-dependency',
                'many-versions-package',
                'pure-python-package',
            }
Beispiel #10
0
        def venv_setup():
            # First just set up a blank virtualenv, this'll bypass the
            # bootstrap when we're actually testing for speed
            if not Path('venv').exists():
                requirements('')
                venv_update()
            install_coverage()

            # Now the actual requirements we'll install
            requirements('\n'.join((
                'project_with_c',
                'pure_python_package==0.2.1',
                'slow_python_package==0.1.0',
                'dependant_package',
                'many_versions_package>=2,<3',
                ''
            )))

            yield

            expected = '\n'.join((
                'dependant-package==1',
                'implicit-dependency==1',
                'many-versions-package==2.1',
                'project-with-c==0.1.0',
                'pure-python-package==0.2.1',
                'slow-python-package==0.1.0',
                'venv-update==%s' % __version__,
                ''
            ))
            assert pip_freeze() == expected
Beispiel #11
0
def test_no_conflicts_when_no_deps_specified(tmpdir):
    venv = tmpdir.join('venv')
    install_coverage(venv)

    pip = venv.join('bin/pip').strpath
    run(pip, 'install', 'venv-update==' + __version__)

    pkgdir = tmpdir.join('pkgdir').ensure_dir()
    setup_py = pkgdir.join('setup.py')

    def _setup_py(many_versions_package_version):
        setup_py.write('from setuptools import setup\n'
                       'setup(\n'
                       '    name="pkg",\n'
                       '    install_requires=["many-versions-package=={}"],\n'
                       ')\n'.format(many_versions_package_version))

    cmd = (
        venv.join('bin/pip-faster').strpath,
        'install',
        '--upgrade',
        pkgdir.strpath,
    )

    _setup_py('1')
    run(*cmd)

    _setup_py('2')
    # Should not complain about conflicts since we specified `--no-deps`
    run(*cmd + ('--no-deps', ))
Beispiel #12
0
def it_installs_stuff_with_dash_e_without_wheeling(tmpdir):
    venv = tmpdir.join('venv')
    install_coverage(venv)

    pip = venv.join('bin/pip').strpath
    run(pip, 'install', 'venv-update==' + __version__)

    # Install a package from git with no extra dependencies in editable mode.
    #
    # We need to install a package from VCS instead of the filesystem because
    # otherwise we aren't testing that editable requirements aren't wheeled
    # (and instead might just be testing that local paths aren't wheeled).
    requirements(
        '-e git+git://github.com/Yelp/dumb-init.git@87545be699a13d0fd31f67199b7782ebd446437e#egg=dumb-init'
    )  # noqa

    run(str(venv.join('bin/pip-faster')), 'install', '-r', 'requirements.txt')

    frozen_requirements = pip_freeze(str(venv)).split('\n')
    assert set(frozen_requirements) == {
        '-e git://github.com/Yelp/dumb-init.git@87545be699a13d0fd31f67199b7782ebd446437e#egg=dumb_init',  # noqa
        'coverage-enable-subprocess==1.0',
        'coverage==ANY',
        'venv-update==' + __version__,
        '',
    }

    # we shouldn't wheel things installed editable
    assert not tuple(cached_wheels(tmpdir))
Beispiel #13
0
        def venv_setup():
            # First just set up a blank virtualenv, this'll bypass the
            # bootstrap when we're actually testing for speed
            if not Path('venv').exists():
                requirements('')
                venv_update()
            install_coverage()

            # Now the actual requirements we'll install
            requirements('\n'.join(
                ('project_with_c', 'pure_python_package==0.2.1',
                 'slow_python_package==0.1.0', 'dependant_package',
                 'many_versions_package>=2,<3', '')))

            yield

            expected = '\n'.join(
                ('appdirs==1.4.3', 'dependant-package==1',
                 'implicit-dependency==1', 'many-versions-package==2.1',
                 'packaging==16.8', 'pip==9.0.1', 'project-with-c==0.1.0',
                 'pure-python-package==0.2.1', 'pyparsing==2.2.0',
                 'setuptools==35.0.2', 'six==1.10.0',
                 'slow-python-package==0.1.0', 'venv-update==%s' % __version__,
                 'wheel==0.29.0', ''))
            assert pip_freeze() == expected
Beispiel #14
0
def it_doesnt_wheel_local_dirs(tmpdir):
    venv = tmpdir.join('venv')
    install_coverage(venv)

    pip = venv.join('bin/pip').strpath
    run(pip, 'install', 'venv-update==' + __version__)

    run(
        venv.join('bin/pip-faster').strpath,
        'install',
        TOP.join('tests/testing/packages/dependant_package').strpath,
    )

    frozen_requirements = pip_freeze(str(venv)).split('\n')
    assert set(frozen_requirements) == set([
        'coverage==4.0.3',
        'coverage-enable-subprocess==0',
        'dependant-package==1',
        'implicit-dependency==1',
        'many-versions-package==3',
        'pure-python-package==0.2.0',
        'venv-update==' + __version__,
        'wheel==0.29.0',
        '',
    ])

    wheelhouse = tmpdir.join('home', '.cache', 'pip-faster', 'wheelhouse')
    assert set(Wheel(f.basename).name for f in wheelhouse.listdir()) == set([
        'implicit-dependency',
        'many-versions-package',
        'pure-python-package',
    ])
Beispiel #15
0
def test_not_installable_thing(tmpdir):
    tmpdir.chdir()
    enable_coverage()

    install_coverage()

    requirements('not-a-real-package-plz')
    with pytest.raises(CalledProcessError):
        venv_update()
Beispiel #16
0
def make_venv():
    enable_coverage()
    venv = Path('venv')
    run('virtualenv', venv.strpath)
    install_coverage(venv.strpath)

    pip = venv.join('bin/pip').strpath
    run(pip, 'install', 'venv-update==' + __version__)
    return venv
Beispiel #17
0
def make_venv():
    enable_coverage()
    venv = Path('venv')
    run('virtualenv', venv.strpath)
    install_coverage(venv.strpath)

    pip = venv.join('bin/pip').strpath
    run(pip, 'install', 'venv-update==' + __version__)
    return venv
Beispiel #18
0
def test_not_installable_thing(tmpdir):
    tmpdir.chdir()
    enable_coverage()

    install_coverage()

    requirements('not-a-real-package-plz')
    with pytest.raises(CalledProcessError):
        venv_update()
Beispiel #19
0
def it_gives_proper_error_without_requirements(tmpdir):
    venv = tmpdir.join('venv')
    install_coverage(venv)

    pip = venv.join('bin/pip').strpath
    run(pip, 'install', 'venv-update==' + __version__)

    _, err = run(str(venv.join('bin/pip-faster')), 'install')
    err = strip_pip_warnings(err)
    assert err.startswith('You must give at least one requirement to install')
Beispiel #20
0
def time_savings(tmpdir, between):
    """install twice, and the second one should be faster, due to whl caching"""
    with tmpdir.as_cwd():
        enable_coverage()
        install_coverage()

        requirements('\n'.join(
            ('project_with_c', 'pure_python_package==0.2.0',
             'slow_python_package==0.1.0', 'dependant_package',
             'many_versions_package>=2,<3', '')))

        from time import time

        start = time()
        venv_update(
            PIP_VERBOSE='1',
            PIP_RETRIES='0',
            PIP_TIMEOUT='0',
        )
        time1 = time() - start
        expected = '\n'.join(
            ('dependant-package==1', 'implicit-dependency==1',
             'many-versions-package==2.1', 'project-with-c==0.1.0',
             'pure-python-package==0.2.0', 'slow-python-package==0.1.0',
             'venv-update==%s' % __version__, 'wheel==0.29.0', ''))
        assert pip_freeze() == expected

        between()
        install_coverage()

        start = time()
        # second install should also need no network access
        # these are localhost addresses with arbitrary invalid ports
        venv_update(
            PIP_VERBOSE='1',
            PIP_RETRIES='0',
            PIP_TIMEOUT='0',
            http_proxy='http://127.0.0.1:111111',
            https_proxy='https://127.0.0.1:222222',
            ftp_proxy='ftp://127.0.0.1:333333',
        )
        time2 = time() - start
        assert pip_freeze() == expected

        print()
        print('%.3fs originally' % time1)
        print('%.3fs subsequently' % time2)

        difference = time1 - time2
        print('%.2fs speedup' % difference)

        ratio = time1 / time2
        percent = (ratio - 1) * 100
        print('%.2f%% speedup' % percent)
        return difference
Beispiel #21
0
def it_gives_proper_error_without_requirements(tmpdir):
    venv = tmpdir.join('venv')
    install_coverage(venv)

    pip = venv.join('bin/pip').strpath
    run(pip, 'install', 'venv-update==' + __version__)

    out, err = run(str(venv.join('bin/pip-faster')), 'install')
    out = uncolor(out)
    assert out.startswith('You must give at least one requirement to install')
    assert err == ''
Beispiel #22
0
def it_gives_proper_error_without_requirements(tmpdir):
    venv = tmpdir.join('venv')
    install_coverage(venv)

    pip = venv.join('bin/pip').strpath
    run(pip, 'install', 'venv-update==' + __version__)

    with pytest.raises(CalledProcessError) as exc_info:
        run(str(venv.join('bin/pip-faster')), 'install')
    _, err = exc_info.value.result
    assert err.startswith('ERROR: You must give at least one requirement to install')
Beispiel #23
0
def test_extra_index_url_doesnt_cache(tmpdir):
    tmpdir.chdir()
    enable_coverage()
    install_coverage()

    requirements('pure-python-package==0.2.1')
    venv_update(
        'pip-command=', 'pip-faster', 'install',
        '--extra-index-url=https://pypi.python.org/simple',
    )

    assert not tuple(cached_wheels(tmpdir))
Beispiel #24
0
def test_extra_index_url_doesnt_cache(tmpdir):
    tmpdir.chdir()
    enable_coverage()
    install_coverage()

    requirements('pure-python-package==0.2.1')
    venv_update(
        'pip-command=', 'pip-faster', 'install',
        '--extra-index-url=https://pypi.python.org/simple',
    )

    assert not tuple(cached_wheels(tmpdir))
Beispiel #25
0
def test_has_extras(tmpdir):
    with tmpdir.as_cwd():
        enable_coverage()
        install_coverage()
        requirements('pure-python-package[my-extra]')

        for _ in range(2):
            venv_update()

            expected = '\n'.join(
                ('implicit-dependency==1', 'pure-python-package==0.2.1',
                 'venv-update==' + __version__, ''))
            assert pip_freeze() == expected
Beispiel #26
0
def it_can_handle_requirements_already_met(tmpdir):
    venv = tmpdir.join('venv')
    install_coverage(venv)

    pip = venv.join('bin/pip').strpath
    run(pip, 'install', 'venv-update==' + __version__)

    requirements('many-versions-package==1')

    run(str(venv.join('bin/pip-faster')), 'install', '-r', 'requirements.txt')
    assert 'many-versions-package==1\n' in pip_freeze(str(venv))

    run(str(venv.join('bin/pip-faster')), 'install', '-r', 'requirements.txt')
    assert 'many-versions-package==1\n' in pip_freeze(str(venv))
Beispiel #27
0
def it_can_handle_requirements_already_met(tmpdir):
    venv = tmpdir.join('venv')
    install_coverage(venv)

    pip = venv.join('bin/pip').strpath
    run(pip, 'install', 'venv-update==' + __version__)

    requirements('many-versions-package==1')

    run(str(venv.join('bin/pip-faster')), 'install', '-r', 'requirements.txt')
    assert 'many-versions-package==1\n' in pip_freeze(str(venv))

    run(str(venv.join('bin/pip-faster')), 'install', '-r', 'requirements.txt')
    assert 'many-versions-package==1\n' in pip_freeze(str(venv))
Beispiel #28
0
def it_caches_downloaded_wheels_from_pypi(tmpdir):
    venv = tmpdir.join('venv')
    install_coverage()

    pip = venv.join('bin/pip').strpath
    run(pip, 'install', 'venv-update==' + __version__)

    run(
        venv.join('bin/pip-faster').strpath, 'install',
        # One of the few wheeled things on our pypi
        'wheeled-package',
    )

    expected = {'wheeled-package'}
    assert {wheel.name for wheel in cached_wheels(tmpdir)} == expected
Beispiel #29
0
def test_doesnt_use_cache_without_index_server(tmpdir):
    tmpdir.chdir()
    enable_coverage()

    requirements('pure-python-package==0.2.1')
    venv_update()

    tmpdir.join('venv').remove()
    install_coverage()

    cmd = ('pip-command=', 'pip-faster', 'install')
    with pytest.raises(CalledProcessError):
        venv_update(*(cmd + ('--no-index',)))
    # But it would succeed if we gave it an index
    venv_update(*cmd)
Beispiel #30
0
def test_has_extras(tmpdir):
    with tmpdir.as_cwd():
        enable_coverage()
        install_coverage()
        requirements('pure-python-package[my-extra]')

        for _ in range(2):
            venv_update()

            expected = '\n'.join(
                ('appdirs==1.4.0', 'implicit-dependency==1', 'packaging==16.8',
                 'pip==9.0.1', 'pure-python-package==0.2.1',
                 'pyparsing==2.1.10', 'setuptools==34.1.1', 'six==1.10.0',
                 'venv-update==' + __version__, 'wheel==0.29.0', ''))
            assert pip_freeze() == expected
Beispiel #31
0
def test_doesnt_use_cache_without_index_server(tmpdir):
    tmpdir.chdir()
    enable_coverage()

    requirements('pure-python-package==0.2.1')
    venv_update()

    tmpdir.join('venv').remove()
    install_coverage()

    cmd = ('pip-command=', 'pip-faster', 'install')
    with pytest.raises(CalledProcessError):
        venv_update(*(cmd + ('--no-index',)))
    # But it would succeed if we gave it an index
    venv_update(*cmd)
Beispiel #32
0
def it_considers_equals_star_not_pinned(tmpdir):
    venv = tmpdir.join('venv')
    install_coverage(venv)

    pip = venv.join('bin/pip').strpath
    run(pip, 'install', 'venv-update==' + __version__)

    run(
        str(venv.join('bin/pip-faster')),
        'install', 'many-versions-package==2',
    )
    run(
        str(venv.join('bin/pip-faster')),
        'install', '--upgrade', 'many-versions-package==2.*',
    )
    assert 'many-versions-package==2.1' in pip_freeze(str(venv)).split('\n')
Beispiel #33
0
def it_installs_stuff_from_requirements_file(tmpdir):
    venv = tmpdir.join('venv')
    install_coverage(venv)

    pip = venv.join('bin/pip').strpath
    run(pip, 'install', 'venv-update==' + __version__)

    # An arbitrary small package: pure_python_package
    requirements('pure_python_package\nproject_with_c')

    run(str(venv.join('bin/pip-faster')), 'install', '-r', 'requirements.txt')

    frozen_requirements = pip_freeze(str(venv)).split('\n')

    assert 'pure-python-package==0.2.1' in frozen_requirements
    assert 'project-with-c==0.1.0' in frozen_requirements
Beispiel #34
0
def it_installs_stuff_from_requirements_file(tmpdir):
    venv = tmpdir.join('venv')
    install_coverage(venv)

    pip = venv.join('bin/pip').strpath
    run(pip, 'install', 'venv-update==' + __version__)

    # An arbitrary small package: pure_python_package
    requirements('pure_python_package\nproject_with_c')

    run(str(venv.join('bin/pip-faster')), 'install', '-r', 'requirements.txt')

    frozen_requirements = pip_freeze(str(venv)).split('\n')

    assert 'pure-python-package==0.2.1' in frozen_requirements
    assert 'project-with-c==0.1.0' in frozen_requirements
Beispiel #35
0
def test_has_extras(tmpdir):
    with tmpdir.as_cwd():
        enable_coverage()
        install_coverage()
        requirements('pure-python-package[my-extra]')

        for _ in range(2):
            venv_update()

            expected = '\n'.join((
                'implicit-dependency==1',
                'pure-python-package==0.2.1',
                'venv-update==' + __version__,
                ''
            ))
            assert pip_freeze() == expected
Beispiel #36
0
def test_cant_wheel_package(tmpdir):
    with tmpdir.as_cwd():
        enable_coverage()
        install_coverage()
        requirements('cant-wheel-package\npure-python-package')

        out, err = venv_update()
        err = strip_pip_warnings(err)
        assert err == '  Failed building wheel for cant-wheel-package\n'

        out = uncolor(out)

        assert '''\
Installing collected packages: cant-wheel-package, pure-python-package
  Running setup.py install for cant-wheel-package ... done
Successfully installed cant-wheel-package-0.1.0 pure-python-package-0.2.1
''' in out  # noqa
        assert pip_freeze().startswith('cant-wheel-package==0.1.0\n')
Beispiel #37
0
def it_caches_downloaded_wheels_extra_index_url(tmpdir):
    venv = tmpdir.join('venv')
    install_coverage()

    pip = venv.join('bin/pip').strpath
    run(pip, 'install', 'venv-update==' + __version__)

    index = os.environ.pop('PIP_INDEX_URL')
    run(
        venv.join('bin/pip-faster').strpath, 'install',
        # bogus index url just to test `--extra-index-url`
        '--index-url', 'file://{}'.format(tmpdir),
        '--extra-index-url', index,
        'wheeled-package',
    )

    expected = {'wheeled-package'}
    assert {wheel.name for wheel in cached_wheels(tmpdir)} == expected
Beispiel #38
0
def it_installs_stuff(tmpdir):
    venv = tmpdir.join('venv')
    install_coverage(venv)

    assert pip_freeze(str(venv)) == '''\
coverage==4.0.3
coverage-enable-subprocess==0
'''

    pip = venv.join('bin/pip').strpath
    run(pip, 'install', 'venv-update==' + __version__)

    assert [req.split('==')[0] for req in pip_freeze(str(venv)).split()] == [
        'coverage', 'coverage-enable-subprocess', 'venv-update', 'wheel'
    ]

    run(str(venv.join('bin/pip-faster')), 'install', 'pure_python_package')

    assert 'pure-python-package==0.2.0' in pip_freeze(str(venv)).split('\n')
Beispiel #39
0
def test_cant_wheel_package(tmpdir):
    with tmpdir.as_cwd():
        enable_coverage()
        install_coverage()
        requirements('cant-wheel-package\npure-python-package')

        out, err = venv_update()
        err = strip_pip_warnings(err)
        assert err == '  Failed building wheel for cant-wheel-package\n'

        out = uncolor(out)

        assert '''\
Installing collected packages: cant-wheel-package, pure-python-package
  Running setup.py install for cant-wheel-package ... done
Successfully installed cant-wheel-package-0.1.0 pure-python-package-0.2.1
''' in out  # noqa
        assert pip_freeze().startswith(
            'cant-wheel-package==0.1.0\n'
        )
Beispiel #40
0
def it_doesnt_wheel_git_repos(tmpdir):
    venv = tmpdir.join('venv')
    install_coverage(venv)

    pip = venv.join('bin/pip').strpath
    run(pip, 'install', 'venv-update==' + __version__)

    run(
        venv.join('bin/pip-faster').strpath,
        'install',
        'git+git://github.com/Yelp/dumb-init.git@87545be699a13d0fd31f67199b7782ebd446437e#egg=dumb-init',  # noqa
    )

    frozen_requirements = pip_freeze(str(venv)).split('\n')
    assert set(frozen_requirements) == {
        'coverage-enable-subprocess==1.0',
        'coverage==ANY',
        'dumb-init==0.5.0',
        'venv-update==' + __version__,
        '',
    }

    assert not tuple(cached_wheels(tmpdir))
Beispiel #41
0
def it_doesnt_wheel_git_repos(tmpdir):
    venv = tmpdir.join('venv')
    install_coverage(venv)

    pip = venv.join('bin/pip').strpath
    run(pip, 'install', 'venv-update==' + __version__)

    run(
        venv.join('bin/pip-faster').strpath,
        'install',
        'git+git://github.com/Yelp/dumb-init.git@87545be699a13d0fd31f67199b7782ebd446437e#egg=dumb-init',  # noqa
    )

    frozen_requirements = pip_freeze(str(venv)).split('\n')
    assert set(frozen_requirements) == {
        'coverage-enable-subprocess==1.0',
        'coverage==ANY',
        'dumb-init==0.5.0',
        'venv-update==' + __version__,
        '',
    }

    assert not tuple(cached_wheels(tmpdir))
Beispiel #42
0
def it_doesnt_wheel_local_dirs(tmpdir):
    venv = tmpdir.join('venv')
    install_coverage(venv)

    pip = venv.join('bin/pip').strpath
    run(pip, 'install', 'venv-update==' + __version__)

    run(
        venv.join('bin/pip-faster').strpath,
        'install',
        TOP.join('tests/testing/packages/dependant_package').strpath,
    )

    frozen_requirements = pip_freeze(str(venv)).split('\n')
    assert set(frozen_requirements) == set([
        'appdirs==1.4.0',
        'coverage==4.3.4',
        'coverage-enable-subprocess==1.0',
        'dependant-package==1',
        'implicit-dependency==1',
        'many-versions-package==3',
        'packaging==16.8',
        'pip==9.0.1',
        'pure-python-package==0.2.1',
        'pyparsing==2.1.10',
        'setuptools==34.1.1',
        'six==1.10.0',
        'venv-update==' + __version__,
        'wheel==0.29.0',
        '',
    ])

    assert set(wheel.name for wheel in cached_wheels(tmpdir)) == set((
        'implicit-dependency',
        'many-versions-package',
        'pure-python-package',
    ))
Beispiel #43
0
def it_can_handle_a_bad_findlink(tmpdir):
    venv = tmpdir.join('venv')
    install_coverage(venv)

    pip = venv.join('bin/pip').strpath
    run(pip, 'install', 'venv-update==' + __version__)

    out, err = run(
        str(venv.join('bin/pip-faster')),
        'install',
        '-vvv',
        '--find-links',
        'git+wat://not/a/thing',
        'pure-python-package',
    )
    out = uncolor(out)

    assert '''
Candidate wheel: pure_python_package-0.2.0-py2.py3-none-any.whl
Installing collected packages: pure-python-package
Successfully installed pure-python-package
''' in out
    assert err == ''
    assert 'pure-python-package==0.2.0' in pip_freeze(str(venv)).split('\n')
Beispiel #44
0
def it_installs_stuff(tmpdir):
    venv = tmpdir.join('venv')
    install_coverage(venv)

    assert pip_freeze(str(venv)) == '''\
coverage==ANY
coverage-enable-subprocess==1.0
'''

    pip = venv.join('bin/pip').strpath
    run(pip, 'install', 'venv-update==' + __version__)

    assert [
        req.split('==')[0]
        for req in pip_freeze(str(venv)).split()
    ] == [
        'coverage',
        'coverage-enable-subprocess',
        'venv-update',
    ]

    run(str(venv.join('bin/pip-faster')), 'install', 'pure_python_package')

    assert 'pure-python-package==0.2.1' in pip_freeze(str(venv)).split('\n')