Example #1
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))
Example #2
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))
Example #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',
            }
Example #4
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',
    }
Example #5
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))
Example #6
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))
Example #7
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))
Example #8
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
Example #9
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
Example #10
0
def test_old_pip_and_setuptools(tmpdir, reqs):
    """We should be able to use pip-faster's wheel building even if we have
    ancient pip and setuptools.

    https://github.com/Yelp/venv-update/issues/33
    """
    tmpdir.chdir()

    # 1. Create an empty virtualenv.
    # 2. Install old pip/setuptools that don't support wheel building.
    # 3. Install pip-faster.
    # 4. Install pure-python-package and assert it was wheeled during install.
    tmpdir.join('venv')
    venv = Path('venv')
    run('virtualenv', venv.strpath)

    # We need to add public PyPI as an extra URL since we're installing
    # packages (setuptools and pip) which aren't available from our PyPI fixture.
    from os import environ
    environ['PIP_EXTRA_INDEX_URL'] = 'https://pypi.python.org/simple/'
    try:
        pip = venv.join('bin/pip').strpath
        for req in reqs:
            run(pip, 'install', '--', req)
        # wheel needs argparse but it won't get installed
        if sys.version_info < (2, 7):
            run(pip, 'install', 'argparse')
        run(pip, 'install', 'venv-update==' + __version__)
    finally:
        del environ['PIP_EXTRA_INDEX_URL']

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

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

    # it was wheeled
    wheel_names = [wheel.name for wheel in cached_wheels(tmpdir)]
    assert 'pure-python-package' in wheel_names
Example #11
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))
Example #12
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))
Example #13
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',
    ))
Example #14
0
def test_old_pip_and_setuptools(tmpdir, reqs):
    """We should be able to use pip-faster's wheel building even if we have
    ancient pip and setuptools.

    https://github.com/Yelp/venv-update/issues/33
    """
    tmpdir.chdir()

    # 1. Create an empty virtualenv.
    # 2. Install old pip/setuptools that don't support wheel building.
    # 3. Install pip-faster.
    # 4. Install pure-python-package and assert it was wheeled during install.
    tmpdir.join('venv')
    venv = Path('venv')
    run('virtualenv', venv.strpath)

    # We need to add public PyPI as an extra URL since we're installing
    # packages (setuptools and pip) which aren't available from our PyPI fixture.
    from os import environ
    environ['PIP_EXTRA_INDEX_URL'] = 'https://pypi.python.org/simple/'
    try:
        pip = venv.join('bin/pip').strpath
        for req in reqs:
            run(pip, 'install', '--', req)
        run(pip, 'install', 'venv-update==' + __version__)
    finally:
        del environ['PIP_EXTRA_INDEX_URL']

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

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

    # it was wheeled
    wheel_names = [wheel.name for wheel in cached_wheels(tmpdir)]
    assert 'pure-python-package' in wheel_names