diff --git a/pipenv/core.py b/pipenv/core.py index 9f79310d..a354d69e 100644 --- a/pipenv/core.py +++ b/pipenv/core.py @@ -1865,6 +1865,8 @@ def do_install( package_name = package_names[0] if len(package_names) > 1: more_packages = package_names[1:] + else: + more_packages = [] # Capture . argument and assign it to nothing if package_name == '.': package_name = False diff --git a/tests/integration/test_install_uri.py b/tests/integration/test_install_uri.py index 50b56d10..f193a2e1 100644 --- a/tests/integration/test_install_uri.py +++ b/tests/integration/test_install_uri.py @@ -1,5 +1,5 @@ import pytest - +import os from flaky import flaky @@ -92,3 +92,32 @@ def test_install_editable_git_tag(PipenvInstance, pip_src_dir, pypi): assert 'git' in p.lockfile['default']['six'] assert p.lockfile['default']['six']['git'] == 'https://github.com/benjaminp/six.git' assert 'ref' in p.lockfile['default']['six'] + + +@pytest.mark.install +@pytest.mark.index +def test_install_named_index_alias(PipenvInstance, pypi): + # This uses the real PyPI since we need Internet to access the Git + # dependency anyway. + with PipenvInstance(pypi=pypi) as p: + with open(p.pipfile_path, 'w') as f: + contents = """ +[[source]] +url = "{0}" +verify_ssl = false +name = "testindex" + +[[source]] +url = "https://pypi.python.org/simple" +verify_ssl = "true" +name = "pypi" + +[packages] +pytz = "*" +six = {{version = "*", index = "pypi"}} + +[dev-packages] + """.format(os.environ.get('PIPENV_TEST_INDEX')).strip() + f.write(contents) + c = p.pipenv('install pytz --index pypi') + assert c.return_code == 0 diff --git a/tests/integration/test_lock.py b/tests/integration/test_lock.py index b157e12a..b31e2281 100644 --- a/tests/integration/test_lock.py +++ b/tests/integration/test_lock.py @@ -150,3 +150,64 @@ records = {extras = ["pandas"], version = "==0.5.2"} assert c.return_code == 0 assert 'tablib' in p.lockfile['default'] assert 'pandas' in p.lockfile['default'] + + +@pytest.mark.skip_lock +@pytest.mark.index +@pytest.mark.needs_internet +def test_private_index_skip_lock(PipenvInstance): + # This uses the real PyPI since we need Internet to access the Git + # dependency anyway. + with PipenvInstance() as p: + with open(p.pipfile_path, 'w') as f: + contents = """ +[[source]] +url = "https://pypi.python.org/simple" +verify_ssl = true +name = "pypi" + +[[source]] +url = "https://testpypi.python.org/pypi" +verify_ssl = true +name = "testpypi" + +[packages] +pipenv-test-private-package = {version = "*", index = "testpypi"} +requests = "*" + """.strip() + f.write(contents) + c = p.pipenv('install --skip-lock') + assert c.return_code == 0 + + +@pytest.mark.requirements +@pytest.mark.lock +@pytest.mark.index +@pytest.mark.needs_internet +def test_private_index_lock_requirements(PipenvInstance): + # This uses the real PyPI since we need Internet to access the Git + # dependency anyway. + with PipenvInstance() as p: + with open(p.pipfile_path, 'w') as f: + contents = """ +[[source]] +url = "https://pypi.python.org/simple" +verify_ssl = true +name = "pypi" + +[[source]] +url = "https://testpypi.python.org/pypi" +verify_ssl = true +name = "testpypi" + +[packages] +pipenv-test-private-package = {version = "*", index = "testpypi"} +requests = "*" + """.strip() + f.write(contents) + c = p.pipenv('install') + assert c.return_code == 0 + c = p.pipenv('lock -r') + assert c.return_code == 0 + assert '-i https://pypi.python.org/simple' in c.out.strip() + assert '--extra-index-url https://testpypi.python.org/pypi' in c.out.strip()