Add test coverage for all fixes

Signed-off-by: Dan Ryan <dan@danryan.co>
This commit is contained in:
Dan Ryan
2018-04-14 01:01:13 -04:00
parent f93b9f2428
commit c78628ba54
3 changed files with 93 additions and 1 deletions
+2
View File
@@ -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
+30 -1
View File
@@ -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
+61
View File
@@ -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()