mirror of
https://github.com/kennethreitz/pipenv.git
synced 2026-06-05 14:50:16 +00:00
passing tests!
This commit is contained in:
@@ -18,6 +18,8 @@ towncrier = {git = "https://github.com/hawkowl/towncrier.git", editable = true,
|
||||
parver = "*"
|
||||
invoke = "*"
|
||||
jedi = "*"
|
||||
isort = "*"
|
||||
rope = "*"
|
||||
|
||||
[packages]
|
||||
|
||||
|
||||
Generated
+17
-1
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"_meta": {
|
||||
"hash": {
|
||||
"sha256": "aff2856f7dce49fb5ee11d97591523d43810c5b8207861184a7c1cf7c8fece35"
|
||||
"sha256": "88d256c1798cc297772ecd3d2152013e0b28201a5364a1c0f8e4dde79b6e200c"
|
||||
},
|
||||
"pipfile-spec": 6,
|
||||
"requires": {},
|
||||
@@ -163,6 +163,15 @@
|
||||
"index": "pypi",
|
||||
"version": "==1.0.0"
|
||||
},
|
||||
"isort": {
|
||||
"hashes": [
|
||||
"sha256:1153601da39a25b14ddc54955dbbacbb6b2d19135386699e2ad58517953b34af",
|
||||
"sha256:b9c40e9750f3d77e6e4d441d8b0266cf555e7cdabdcff33c4fd06366ca761ef8",
|
||||
"sha256:ec9ef8f4a9bc6f71eec99e1806bfa2de401650d996c59330782b89a5555c1497"
|
||||
],
|
||||
"index": "pypi",
|
||||
"version": "==4.3.4"
|
||||
},
|
||||
"itsdangerous": {
|
||||
"hashes": [
|
||||
"sha256:cbb3fcf8d3e33df861709ecaf89d9e6629cff0a217bc2848f1b41cd30d360519"
|
||||
@@ -355,6 +364,13 @@
|
||||
],
|
||||
"version": "==0.8.0"
|
||||
},
|
||||
"rope": {
|
||||
"hashes": [
|
||||
"sha256:a09edfd2034fd50099a67822f9bd851fbd0f4e98d3b87519f6267b60e50d80d1"
|
||||
],
|
||||
"index": "pypi",
|
||||
"version": "==0.10.7"
|
||||
},
|
||||
"six": {
|
||||
"hashes": [
|
||||
"sha256:70e8a77beed4562e7f14fe23a786b54f6296e34344c23bc42f07b15018ff98e9",
|
||||
|
||||
@@ -287,8 +287,6 @@ def cli(
|
||||
echo(format_help(ctx.get_help()))
|
||||
|
||||
|
||||
|
||||
|
||||
@command(
|
||||
short_help="Installs provided packages and adds them to Pipfile, or (if none is given), installs all packages.",
|
||||
context_settings=dict(ignore_unknown_options=True, allow_extra_args=True),
|
||||
@@ -834,8 +832,6 @@ def update(
|
||||
do_outdated,
|
||||
do_lock,
|
||||
do_sync,
|
||||
ensure_lockfile,
|
||||
do_install,
|
||||
project,
|
||||
)
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import contextlib
|
||||
import os
|
||||
|
||||
from pipenv.utils import temp_environ
|
||||
@@ -17,53 +16,55 @@ from flaky import flaky
|
||||
def test_basic_setup(PipenvInstance, pypi):
|
||||
with PipenvInstance(pypi=pypi) as p:
|
||||
with PipenvInstance(pipfile=False) as p:
|
||||
c = p.pipenv('install requests')
|
||||
c = p.pipenv("install requests")
|
||||
assert c.return_code == 0
|
||||
|
||||
assert 'requests' in p.pipfile['packages']
|
||||
assert 'requests' in p.lockfile['default']
|
||||
assert 'chardet' in p.lockfile['default']
|
||||
assert 'idna' in p.lockfile['default']
|
||||
assert 'urllib3' in p.lockfile['default']
|
||||
assert 'certifi' in p.lockfile['default']
|
||||
assert "requests" in p.pipfile["packages"]
|
||||
assert "requests" in p.lockfile["default"]
|
||||
assert "chardet" in p.lockfile["default"]
|
||||
assert "idna" in p.lockfile["default"]
|
||||
assert "urllib3" in p.lockfile["default"]
|
||||
assert "certifi" in p.lockfile["default"]
|
||||
|
||||
|
||||
@pytest.mark.install
|
||||
@flaky
|
||||
def test_basic_install(PipenvInstance, pypi):
|
||||
with PipenvInstance(pypi=pypi) as p:
|
||||
c = p.pipenv('install requests')
|
||||
c = p.pipenv("install requests")
|
||||
assert c.return_code == 0
|
||||
assert 'requests' in p.pipfile['packages']
|
||||
assert 'requests' in p.lockfile['default']
|
||||
assert 'chardet' in p.lockfile['default']
|
||||
assert 'idna' in p.lockfile['default']
|
||||
assert 'urllib3' in p.lockfile['default']
|
||||
assert 'certifi' in p.lockfile['default']
|
||||
assert "requests" in p.pipfile["packages"]
|
||||
assert "requests" in p.lockfile["default"]
|
||||
assert "chardet" in p.lockfile["default"]
|
||||
assert "idna" in p.lockfile["default"]
|
||||
assert "urllib3" in p.lockfile["default"]
|
||||
assert "certifi" in p.lockfile["default"]
|
||||
|
||||
|
||||
@pytest.mark.install
|
||||
@flaky
|
||||
def test_mirror_install(PipenvInstance, pypi):
|
||||
with temp_environ(), PipenvInstance(chdir=True) as p:
|
||||
mirror_url = os.environ.pop('PIPENV_TEST_INDEX', "https://pypi.python.org/simple")
|
||||
assert 'pypi.org' not in mirror_url
|
||||
mirror_url = os.environ.pop(
|
||||
"PIPENV_TEST_INDEX", "https://pypi.python.org/simple"
|
||||
)
|
||||
assert "pypi.org" not in mirror_url
|
||||
# This should sufficiently demonstrate the mirror functionality
|
||||
# since pypi.org is the default when PIPENV_TEST_INDEX is unset.
|
||||
c = p.pipenv('install requests --pypi-mirror {0}'.format(mirror_url))
|
||||
c = p.pipenv("install requests --pypi-mirror {0}".format(mirror_url))
|
||||
assert c.return_code == 0
|
||||
# Ensure the --pypi-mirror parameter hasn't altered the Pipfile or Pipfile.lock sources
|
||||
assert len(p.pipfile['source']) == 1
|
||||
assert len(p.pipfile["source"]) == 1
|
||||
assert len(p.lockfile["_meta"]["sources"]) == 1
|
||||
assert 'https://pypi.org/simple' == p.pipfile['source'][0]['url']
|
||||
assert 'https://pypi.org/simple' == p.lockfile['_meta']['sources'][0]['url']
|
||||
assert "https://pypi.org/simple" == p.pipfile["source"][0]["url"]
|
||||
assert "https://pypi.org/simple" == p.lockfile["_meta"]["sources"][0]["url"]
|
||||
|
||||
assert 'requests' in p.pipfile['packages']
|
||||
assert 'requests' in p.lockfile['default']
|
||||
assert 'chardet' in p.lockfile['default']
|
||||
assert 'idna' in p.lockfile['default']
|
||||
assert 'urllib3' in p.lockfile['default']
|
||||
assert 'certifi' in p.lockfile['default']
|
||||
assert "requests" in p.pipfile["packages"]
|
||||
assert "requests" in p.lockfile["default"]
|
||||
assert "chardet" in p.lockfile["default"]
|
||||
assert "idna" in p.lockfile["default"]
|
||||
assert "urllib3" in p.lockfile["default"]
|
||||
assert "certifi" in p.lockfile["default"]
|
||||
|
||||
|
||||
@pytest.mark.install
|
||||
@@ -72,21 +73,21 @@ def test_mirror_install(PipenvInstance, pypi):
|
||||
def test_bad_mirror_install(PipenvInstance, pypi):
|
||||
with temp_environ(), PipenvInstance(chdir=True) as p:
|
||||
# This demonstrates that the mirror parameter is being used
|
||||
os.environ.pop('PIPENV_TEST_INDEX', None)
|
||||
c = p.pipenv('install requests --pypi-mirror https://pypi.example.org')
|
||||
os.environ.pop("PIPENV_TEST_INDEX", None)
|
||||
c = p.pipenv("install requests --pypi-mirror https://pypi.example.org")
|
||||
assert c.return_code != 0
|
||||
|
||||
|
||||
@pytest.mark.complex
|
||||
@pytest.mark.lock
|
||||
@pytest.mark.skip(reason='Does not work unless you can explicitly install into py2')
|
||||
@pytest.mark.skip(reason="Does not work unless you can explicitly install into py2")
|
||||
def test_complex_lock(PipenvInstance, pypi):
|
||||
with PipenvInstance(pypi=pypi) as p:
|
||||
c = p.pipenv('install apscheduler')
|
||||
c = p.pipenv("install apscheduler")
|
||||
assert c.return_code == 0
|
||||
assert 'apscheduler' in p.pipfile['packages']
|
||||
assert 'funcsigs' in p.lockfile[u'default']
|
||||
assert 'futures' in p.lockfile[u'default']
|
||||
assert "apscheduler" in p.pipfile["packages"]
|
||||
assert "funcsigs" in p.lockfile[u"default"]
|
||||
assert "futures" in p.lockfile[u"default"]
|
||||
|
||||
|
||||
@pytest.mark.dev
|
||||
@@ -94,16 +95,16 @@ def test_complex_lock(PipenvInstance, pypi):
|
||||
@flaky
|
||||
def test_basic_dev_install(PipenvInstance, pypi):
|
||||
with PipenvInstance(pypi=pypi) as p:
|
||||
c = p.pipenv('install requests --dev')
|
||||
c = p.pipenv("install requests --dev")
|
||||
assert c.return_code == 0
|
||||
assert 'requests' in p.pipfile['dev-packages']
|
||||
assert 'requests' in p.lockfile['develop']
|
||||
assert 'chardet' in p.lockfile['develop']
|
||||
assert 'idna' in p.lockfile['develop']
|
||||
assert 'urllib3' in p.lockfile['develop']
|
||||
assert 'certifi' in p.lockfile['develop']
|
||||
assert "requests" in p.pipfile["dev-packages"]
|
||||
assert "requests" in p.lockfile["develop"]
|
||||
assert "chardet" in p.lockfile["develop"]
|
||||
assert "idna" in p.lockfile["develop"]
|
||||
assert "urllib3" in p.lockfile["develop"]
|
||||
assert "certifi" in p.lockfile["develop"]
|
||||
|
||||
c = p.pipenv('run python -m requests.help')
|
||||
c = p.pipenv("run python -m requests.help")
|
||||
assert c.return_code == 0
|
||||
|
||||
|
||||
@@ -113,7 +114,7 @@ def test_basic_dev_install(PipenvInstance, pypi):
|
||||
def test_install_without_dev(PipenvInstance, pypi):
|
||||
"""Ensure that running `pipenv install` doesn't install dev packages"""
|
||||
with PipenvInstance(pypi=pypi, chdir=True) as p:
|
||||
with open(p.pipfile_path, 'w') as f:
|
||||
with open(p.pipfile_path, "w") as f:
|
||||
contents = """
|
||||
[packages]
|
||||
six = "*"
|
||||
@@ -122,12 +123,12 @@ six = "*"
|
||||
pytz = "*"
|
||||
""".strip()
|
||||
f.write(contents)
|
||||
c = p.pipenv('install')
|
||||
c = p.pipenv("install")
|
||||
assert c.return_code == 0
|
||||
assert 'six' in p.pipfile['packages']
|
||||
assert 'pytz' in p.pipfile['dev-packages']
|
||||
assert 'six' in p.lockfile['default']
|
||||
assert 'pytz' in p.lockfile['develop']
|
||||
assert "six" in p.pipfile["packages"]
|
||||
assert "pytz" in p.pipfile["dev-packages"]
|
||||
assert "six" in p.lockfile["default"]
|
||||
assert "pytz" in p.lockfile["develop"]
|
||||
c = p.pipenv('run python -c "import pytz"')
|
||||
assert c.return_code != 0
|
||||
c = p.pipenv('run python -c "import six"')
|
||||
@@ -138,18 +139,18 @@ pytz = "*"
|
||||
@flaky
|
||||
def test_install_without_dev_section(PipenvInstance, pypi):
|
||||
with PipenvInstance(pypi=pypi) as p:
|
||||
with open(p.pipfile_path, 'w') as f:
|
||||
with open(p.pipfile_path, "w") as f:
|
||||
contents = """
|
||||
[packages]
|
||||
six = "*"
|
||||
""".strip()
|
||||
f.write(contents)
|
||||
c = p.pipenv('install')
|
||||
c = p.pipenv("install")
|
||||
assert c.return_code == 0
|
||||
assert 'six' in p.pipfile['packages']
|
||||
assert p.pipfile.get('dev-packages', {}) == {}
|
||||
assert 'six' in p.lockfile['default']
|
||||
assert p.lockfile['develop'] == {}
|
||||
assert "six" in p.pipfile["packages"]
|
||||
assert p.pipfile.get("dev-packages", {}) == {}
|
||||
assert "six" in p.lockfile["default"]
|
||||
assert p.lockfile["develop"] == {}
|
||||
c = p.pipenv('run python -c "import six"')
|
||||
assert c.return_code == 0
|
||||
|
||||
@@ -159,16 +160,16 @@ six = "*"
|
||||
@flaky
|
||||
def test_extras_install(PipenvInstance, pypi):
|
||||
with PipenvInstance(pypi=pypi, chdir=True) as p:
|
||||
c = p.pipenv('install requests[socks]')
|
||||
c = p.pipenv("install requests[socks]")
|
||||
assert c.return_code == 0
|
||||
assert 'requests' in p.pipfile['packages']
|
||||
assert 'extras' in p.pipfile['packages']['requests']
|
||||
assert "requests" in p.pipfile["packages"]
|
||||
assert "extras" in p.pipfile["packages"]["requests"]
|
||||
|
||||
assert 'requests' in p.lockfile['default']
|
||||
assert 'chardet' in p.lockfile['default']
|
||||
assert 'idna' in p.lockfile['default']
|
||||
assert 'urllib3' in p.lockfile['default']
|
||||
assert 'pysocks' in p.lockfile['default']
|
||||
assert "requests" in p.lockfile["default"]
|
||||
assert "chardet" in p.lockfile["default"]
|
||||
assert "idna" in p.lockfile["default"]
|
||||
assert "urllib3" in p.lockfile["default"]
|
||||
assert "pysocks" in p.lockfile["default"]
|
||||
|
||||
|
||||
@pytest.mark.install
|
||||
@@ -176,16 +177,16 @@ def test_extras_install(PipenvInstance, pypi):
|
||||
@flaky
|
||||
def test_windows_pinned_pipfile(PipenvInstance, pypi):
|
||||
with PipenvInstance(pypi=pypi) as p:
|
||||
with open(p.pipfile_path, 'w') as f:
|
||||
with open(p.pipfile_path, "w") as f:
|
||||
contents = """
|
||||
[packages]
|
||||
tablib = "<0.12"
|
||||
requests = "==2.19.1"
|
||||
""".strip()
|
||||
f.write(contents)
|
||||
c = p.pipenv('install')
|
||||
c = p.pipenv("install")
|
||||
assert c.return_code == 0
|
||||
assert 'tablib' in p.pipfile['packages']
|
||||
assert 'tablib' in p.lockfile['default']
|
||||
assert "requests" in p.pipfile["packages"]
|
||||
assert "requests" in p.lockfile["default"]
|
||||
|
||||
|
||||
@pytest.mark.install
|
||||
@@ -194,16 +195,16 @@ tablib = "<0.12"
|
||||
@flaky
|
||||
def test_backup_resolver(PipenvInstance, pypi):
|
||||
with PipenvInstance(pypi=pypi) as p:
|
||||
with open(p.pipfile_path, 'w') as f:
|
||||
with open(p.pipfile_path, "w") as f:
|
||||
contents = """
|
||||
[packages]
|
||||
"ibm-db-sa-py3" = "==0.3.1-1"
|
||||
""".strip()
|
||||
f.write(contents)
|
||||
|
||||
c = p.pipenv('install')
|
||||
c = p.pipenv("install")
|
||||
assert c.return_code == 0
|
||||
assert 'ibm-db-sa-py3' in p.lockfile['default']
|
||||
assert "ibm-db-sa-py3" in p.lockfile["default"]
|
||||
|
||||
|
||||
@pytest.mark.run
|
||||
@@ -211,21 +212,21 @@ def test_backup_resolver(PipenvInstance, pypi):
|
||||
@flaky
|
||||
def test_alternative_version_specifier(PipenvInstance, pypi):
|
||||
with PipenvInstance(pypi=pypi) as p:
|
||||
with open(p.pipfile_path, 'w') as f:
|
||||
with open(p.pipfile_path, "w") as f:
|
||||
contents = """
|
||||
[packages]
|
||||
requests = {version = "*"}
|
||||
""".strip()
|
||||
f.write(contents)
|
||||
|
||||
c = p.pipenv('install')
|
||||
c = p.pipenv("install")
|
||||
assert c.return_code == 0
|
||||
|
||||
assert 'requests' in p.lockfile['default']
|
||||
assert 'idna' in p.lockfile['default']
|
||||
assert 'urllib3' in p.lockfile['default']
|
||||
assert 'certifi' in p.lockfile['default']
|
||||
assert 'chardet' in p.lockfile['default']
|
||||
assert "requests" in p.lockfile["default"]
|
||||
assert "idna" in p.lockfile["default"]
|
||||
assert "urllib3" in p.lockfile["default"]
|
||||
assert "certifi" in p.lockfile["default"]
|
||||
assert "chardet" in p.lockfile["default"]
|
||||
|
||||
c = p.pipenv('run python -c "import requests; import idna; import certifi;"')
|
||||
assert c.return_code == 0
|
||||
@@ -235,7 +236,7 @@ requests = {version = "*"}
|
||||
@pytest.mark.install
|
||||
def test_bad_packages(PipenvInstance, pypi):
|
||||
with PipenvInstance(pypi=pypi) as p:
|
||||
c = p.pipenv('install NotAPackage')
|
||||
c = p.pipenv("install NotAPackage")
|
||||
assert c.return_code > 0
|
||||
|
||||
|
||||
@@ -248,25 +249,25 @@ def test_requirements_to_pipfile(PipenvInstance, pypi):
|
||||
with PipenvInstance(pipfile=False, chdir=True, pypi=pypi) as p:
|
||||
|
||||
# Write a requirements file
|
||||
with open('requirements.txt', 'w') as f:
|
||||
f.write('requests[socks]==2.18.1\n')
|
||||
with open("requirements.txt", "w") as f:
|
||||
f.write("requests[socks]==2.18.1\n")
|
||||
|
||||
c = p.pipenv('install')
|
||||
c = p.pipenv("install")
|
||||
assert c.return_code == 0
|
||||
print(c.out)
|
||||
print(c.err)
|
||||
print(delegator.run('ls -l').out)
|
||||
print(delegator.run("ls -l").out)
|
||||
|
||||
# assert stuff in pipfile
|
||||
assert 'requests' in p.pipfile['packages']
|
||||
assert 'extras' in p.pipfile['packages']['requests']
|
||||
assert "requests" in p.pipfile["packages"]
|
||||
assert "extras" in p.pipfile["packages"]["requests"]
|
||||
|
||||
# assert stuff in lockfile
|
||||
assert 'requests' in p.lockfile['default']
|
||||
assert 'chardet' in p.lockfile['default']
|
||||
assert 'idna' in p.lockfile['default']
|
||||
assert 'urllib3' in p.lockfile['default']
|
||||
assert 'pysocks' in p.lockfile['default']
|
||||
assert "requests" in p.lockfile["default"]
|
||||
assert "chardet" in p.lockfile["default"]
|
||||
assert "idna" in p.lockfile["default"]
|
||||
assert "urllib3" in p.lockfile["default"]
|
||||
assert "pysocks" in p.lockfile["default"]
|
||||
|
||||
|
||||
@pytest.mark.install
|
||||
@@ -278,31 +279,31 @@ def test_skip_requirements_when_pipfile(PipenvInstance, pypi):
|
||||
2. A Pipfile already exists when we run `pipenv install`.
|
||||
"""
|
||||
with PipenvInstance(chdir=True, pypi=pypi) as p:
|
||||
with open('requirements.txt', 'w') as f:
|
||||
f.write('requests==2.18.1\n')
|
||||
c = p.pipenv('install six')
|
||||
with open("requirements.txt", "w") as f:
|
||||
f.write("requests==2.18.1\n")
|
||||
c = p.pipenv("install six")
|
||||
assert c.return_code == 0
|
||||
with open(p.pipfile_path, 'w') as f:
|
||||
with open(p.pipfile_path, "w") as f:
|
||||
contents = """
|
||||
[packages]
|
||||
six = "*"
|
||||
tablib = "<0.12"
|
||||
""".strip()
|
||||
f.write(contents)
|
||||
c = p.pipenv('install')
|
||||
assert 'tablib' in p.pipfile['packages']
|
||||
assert 'tablib' in p.lockfile['default']
|
||||
assert 'six' in p.pipfile['packages']
|
||||
assert 'six' in p.lockfile['default']
|
||||
assert 'requests' not in p.pipfile['packages']
|
||||
assert 'requests' not in p.lockfile['default']
|
||||
c = p.pipenv("install")
|
||||
assert "tablib" in p.pipfile["packages"]
|
||||
assert "tablib" in p.lockfile["default"]
|
||||
assert "six" in p.pipfile["packages"]
|
||||
assert "six" in p.lockfile["default"]
|
||||
assert "requests" not in p.pipfile["packages"]
|
||||
assert "requests" not in p.lockfile["default"]
|
||||
|
||||
|
||||
@pytest.mark.cli
|
||||
@pytest.mark.clean
|
||||
def test_clean_on_empty_venv(PipenvInstance, pypi):
|
||||
with PipenvInstance(pypi=pypi) as p:
|
||||
c = p.pipenv('clean')
|
||||
c = p.pipenv("clean")
|
||||
assert c.return_code == 0
|
||||
|
||||
|
||||
@@ -311,27 +312,29 @@ def test_install_does_not_extrapolate_environ(PipenvInstance, pypi):
|
||||
"""Ensure environment variables are not expanded in lock file.
|
||||
"""
|
||||
with temp_environ(), PipenvInstance(pypi=pypi, chdir=True) as p:
|
||||
os.environ['PYPI_URL'] = pypi.url
|
||||
os.environ["PYPI_URL"] = pypi.url
|
||||
|
||||
with open(p.pipfile_path, 'w') as f:
|
||||
f.write("""
|
||||
with open(p.pipfile_path, "w") as f:
|
||||
f.write(
|
||||
"""
|
||||
[[source]]
|
||||
url = '${PYPI_URL}/simple'
|
||||
verify_ssl = true
|
||||
name = 'mockpi'
|
||||
""")
|
||||
"""
|
||||
)
|
||||
|
||||
# Ensure simple install does not extrapolate.
|
||||
c = p.pipenv('install')
|
||||
c = p.pipenv("install")
|
||||
assert c.return_code == 0
|
||||
assert p.pipfile['source'][0]['url'] == '${PYPI_URL}/simple'
|
||||
assert p.lockfile['_meta']['sources'][0]['url'] == '${PYPI_URL}/simple'
|
||||
assert p.pipfile["source"][0]["url"] == "${PYPI_URL}/simple"
|
||||
assert p.lockfile["_meta"]["sources"][0]["url"] == "${PYPI_URL}/simple"
|
||||
|
||||
# Ensure package install does not extrapolate.
|
||||
c = p.pipenv('install six')
|
||||
c = p.pipenv("install six")
|
||||
assert c.return_code == 0
|
||||
assert p.pipfile['source'][0]['url'] == '${PYPI_URL}/simple'
|
||||
assert p.lockfile['_meta']['sources'][0]['url'] == '${PYPI_URL}/simple'
|
||||
assert p.pipfile["source"][0]["url"] == "${PYPI_URL}/simple"
|
||||
assert p.lockfile["_meta"]["sources"][0]["url"] == "${PYPI_URL}/simple"
|
||||
|
||||
|
||||
@pytest.mark.editable
|
||||
@@ -339,9 +342,9 @@ name = 'mockpi'
|
||||
@pytest.mark.install
|
||||
def test_editable_no_args(PipenvInstance):
|
||||
with PipenvInstance() as p:
|
||||
c = p.pipenv('install -e')
|
||||
c = p.pipenv("install -e")
|
||||
assert c.return_code != 0
|
||||
assert 'Please provide path to editable package' in c.err
|
||||
assert "Please provide path to editable package" in c.err
|
||||
|
||||
|
||||
@pytest.mark.install
|
||||
@@ -353,33 +356,37 @@ def test_install_venv_project_directory(PipenvInstance, pypi):
|
||||
workon_home based virtualenv for this test.
|
||||
"""
|
||||
with PipenvInstance(pypi=pypi, chdir=True) as p:
|
||||
with temp_environ(), TemporaryDirectory(prefix='pipenv-', suffix='temp_workon_home') as workon_home:
|
||||
os.environ['WORKON_HOME'] = workon_home.name
|
||||
if 'PIPENV_VENV_IN_PROJECT' in os.environ:
|
||||
del os.environ['PIPENV_VENV_IN_PROJECT']
|
||||
c = p.pipenv('install six')
|
||||
with temp_environ(), TemporaryDirectory(
|
||||
prefix="pipenv-", suffix="temp_workon_home"
|
||||
) as workon_home:
|
||||
os.environ["WORKON_HOME"] = workon_home.name
|
||||
if "PIPENV_VENV_IN_PROJECT" in os.environ:
|
||||
del os.environ["PIPENV_VENV_IN_PROJECT"]
|
||||
c = p.pipenv("install six")
|
||||
assert c.return_code == 0
|
||||
project = Project()
|
||||
assert Path(project.virtualenv_location).joinpath('.project').exists()
|
||||
assert Path(project.virtualenv_location).joinpath(".project").exists()
|
||||
|
||||
|
||||
@pytest.mark.deploy
|
||||
@pytest.mark.system
|
||||
def test_system_and_deploy_work(PipenvInstance, pypi):
|
||||
with PipenvInstance(chdir=True, pypi=pypi) as p:
|
||||
c = p.pipenv('install six requests')
|
||||
c = p.pipenv("install six requests")
|
||||
assert c.return_code == 0
|
||||
c = p.pipenv('--rm')
|
||||
c = p.pipenv("--rm")
|
||||
assert c.return_code == 0
|
||||
c = delegator.run('virtualenv .venv')
|
||||
c = delegator.run("virtualenv .venv")
|
||||
assert c.return_code == 0
|
||||
c = p.pipenv('install --system --deploy')
|
||||
c = p.pipenv("install --system --deploy")
|
||||
assert c.return_code == 0
|
||||
c = p.pipenv('--rm')
|
||||
c = p.pipenv("--rm")
|
||||
assert c.return_code == 0
|
||||
Path(p.pipfile_path).write_text(u"""
|
||||
Path(p.pipfile_path).write_text(
|
||||
u"""
|
||||
[packages]
|
||||
requests
|
||||
""".strip())
|
||||
c = p.pipenv('install --system')
|
||||
""".strip()
|
||||
)
|
||||
c = p.pipenv("install --system")
|
||||
assert c.return_code == 0
|
||||
|
||||
@@ -11,15 +11,18 @@ from pipenv._compat import Path
|
||||
@flaky
|
||||
def test_basic_vcs_install(PipenvInstance, pip_src_dir, pypi):
|
||||
with PipenvInstance(pypi=pypi, chdir=True) as p:
|
||||
c = p.pipenv('install git+https://github.com/benjaminp/six.git@1.11.0#egg=six')
|
||||
c = p.pipenv("install git+https://github.com/benjaminp/six.git@1.11.0#egg=six")
|
||||
assert c.return_code == 0
|
||||
# edge case where normal package starts with VCS name shouldn't be flagged as vcs
|
||||
c = p.pipenv('install gitdb2')
|
||||
c = p.pipenv("install gitdb2")
|
||||
assert c.return_code == 0
|
||||
assert all(package in p.pipfile['packages'] for package in ['six', 'gitdb2'])
|
||||
assert 'git' in p.pipfile['packages']['six']
|
||||
assert p.lockfile['default']['six'] == {"git": "https://github.com/benjaminp/six.git", "ref": "15e31431af97e5e64b80af0a3f598d382bcdd49a"}
|
||||
assert 'gitdb2' in p.lockfile['default']
|
||||
assert all(package in p.pipfile["packages"] for package in ["six", "gitdb2"])
|
||||
assert "git" in p.pipfile["packages"]["six"]
|
||||
assert p.lockfile["default"]["six"] == {
|
||||
"git": "https://github.com/benjaminp/six.git",
|
||||
"ref": "15e31431af97e5e64b80af0a3f598d382bcdd49a",
|
||||
}
|
||||
assert "gitdb2" in p.lockfile["default"]
|
||||
|
||||
|
||||
@pytest.mark.files
|
||||
@@ -28,23 +31,24 @@ def test_basic_vcs_install(PipenvInstance, pip_src_dir, pypi):
|
||||
@flaky
|
||||
def test_urls_work(PipenvInstance, pypi, pip_src_dir):
|
||||
with PipenvInstance(pypi=pypi) as p:
|
||||
c = p.pipenv('install https://github.com/divio/django-cms/archive/release/3.4.x.zip')
|
||||
c = p.pipenv(
|
||||
"install https://github.com/divio/django-cms/archive/release/3.4.x.zip"
|
||||
)
|
||||
assert c.return_code == 0
|
||||
|
||||
dep = list(p.pipfile['packages'].values())[0]
|
||||
assert 'file' in dep, p.pipfile
|
||||
dep = list(p.pipfile["packages"].values())[0]
|
||||
assert "file" in dep, p.pipfile
|
||||
|
||||
dep = list(p.lockfile['default'].values())[0]
|
||||
assert 'file' in dep, p.lockfile
|
||||
dep = list(p.lockfile["default"].values())[0]
|
||||
assert "file" in dep, p.lockfile
|
||||
|
||||
|
||||
@pytest.mark.files
|
||||
@pytest.mark.urls
|
||||
def test_file_urls_work(PipenvInstance, pip_src_dir):
|
||||
with PipenvInstance(chdir=True) as p:
|
||||
whl = (
|
||||
Path(__file__).parent.parent
|
||||
.joinpath('pypi', 'six', 'six-1.11.0-py2.py3-none-any.whl')
|
||||
whl = Path(__file__).parent.parent.joinpath(
|
||||
"pypi", "six", "six-1.11.0-py2.py3-none-any.whl"
|
||||
)
|
||||
try:
|
||||
whl = whl.resolve()
|
||||
@@ -53,9 +57,8 @@ def test_file_urls_work(PipenvInstance, pip_src_dir):
|
||||
wheel_url = whl.as_uri()
|
||||
c = p.pipenv('install "{0}"'.format(wheel_url))
|
||||
assert c.return_code == 0
|
||||
assert 'six' in p.pipfile['packages']
|
||||
assert 'file' in p.pipfile['packages']['six']
|
||||
|
||||
assert "six" in p.pipfile["packages"]
|
||||
assert "file" in p.pipfile["packages"]["six"]
|
||||
|
||||
|
||||
@pytest.mark.files
|
||||
@@ -63,38 +66,16 @@ def test_file_urls_work(PipenvInstance, pip_src_dir):
|
||||
@pytest.mark.needs_internet
|
||||
def test_local_vcs_urls_work(PipenvInstance, pypi):
|
||||
with PipenvInstance(pypi=pypi, chdir=True) as p:
|
||||
six_path = Path(p.path).joinpath('six').absolute()
|
||||
six_path = Path(p.path).joinpath("six").absolute()
|
||||
c = delegator.run(
|
||||
'git clone '
|
||||
'https://github.com/benjaminp/six.git {0}'.format(six_path)
|
||||
"git clone " "https://github.com/benjaminp/six.git {0}".format(six_path)
|
||||
)
|
||||
assert c.return_code == 0
|
||||
|
||||
c = p.pipenv('install git+{0}#egg=six'.format(six_path.as_uri()))
|
||||
c = p.pipenv("install git+{0}#egg=six".format(six_path.as_uri()))
|
||||
assert c.return_code == 0
|
||||
|
||||
|
||||
@pytest.mark.files
|
||||
@pytest.mark.urls
|
||||
@pytest.mark.needs_internet
|
||||
@flaky
|
||||
def test_install_remote_requirements(PipenvInstance, pypi):
|
||||
with PipenvInstance(pypi=pypi) as p:
|
||||
# using a github hosted requirements.txt file
|
||||
c = p.pipenv('install -r https://raw.githubusercontent.com/kennethreitz/pipenv/3688148ac7cfecefb085c474b092c31d791952c1/tests/test_artifacts/requirements.txt')
|
||||
|
||||
assert c.return_code == 0
|
||||
# check Pipfile with versions
|
||||
assert 'requests' in p.pipfile['packages']
|
||||
assert p.pipfile['packages']['requests'] == u'==2.18.4'
|
||||
assert 'records' in p.pipfile['packages']
|
||||
assert p.pipfile['packages']['records'] == u'==0.5.2'
|
||||
|
||||
# check Pipfile.lock
|
||||
assert 'requests' in p.lockfile['default']
|
||||
assert 'records' in p.lockfile['default']
|
||||
|
||||
|
||||
@pytest.mark.e
|
||||
@pytest.mark.vcs
|
||||
@pytest.mark.install
|
||||
@@ -102,16 +83,18 @@ def test_install_remote_requirements(PipenvInstance, pypi):
|
||||
@flaky
|
||||
def test_editable_vcs_install(PipenvInstance, pip_src_dir, pypi):
|
||||
with PipenvInstance(pypi=pypi) as p:
|
||||
c = p.pipenv('install -e git+https://github.com/requests/requests.git#egg=requests')
|
||||
c = p.pipenv(
|
||||
"install -e git+https://github.com/requests/requests.git#egg=requests"
|
||||
)
|
||||
assert c.return_code == 0
|
||||
assert 'requests' in p.pipfile['packages']
|
||||
assert 'git' in p.pipfile['packages']['requests']
|
||||
assert 'editable' in p.pipfile['packages']['requests']
|
||||
assert 'editable' in p.lockfile['default']['requests']
|
||||
assert 'chardet' in p.lockfile['default']
|
||||
assert 'idna' in p.lockfile['default']
|
||||
assert 'urllib3' in p.lockfile['default']
|
||||
assert 'certifi' in p.lockfile['default']
|
||||
assert "requests" in p.pipfile["packages"]
|
||||
assert "git" in p.pipfile["packages"]["requests"]
|
||||
assert "editable" in p.pipfile["packages"]["requests"]
|
||||
assert "editable" in p.lockfile["default"]["requests"]
|
||||
assert "chardet" in p.lockfile["default"]
|
||||
assert "idna" in p.lockfile["default"]
|
||||
assert "urllib3" in p.lockfile["default"]
|
||||
assert "certifi" in p.lockfile["default"]
|
||||
|
||||
|
||||
@pytest.mark.install
|
||||
@@ -123,13 +106,18 @@ def test_install_editable_git_tag(PipenvInstance, pip_src_dir, pypi):
|
||||
# This uses the real PyPI since we need Internet to access the Git
|
||||
# dependency anyway.
|
||||
with PipenvInstance(pypi=pypi) as p:
|
||||
c = p.pipenv('install -e git+https://github.com/benjaminp/six.git@1.11.0#egg=six')
|
||||
c = p.pipenv(
|
||||
"install -e git+https://github.com/benjaminp/six.git@1.11.0#egg=six"
|
||||
)
|
||||
assert c.return_code == 0
|
||||
assert 'six' in p.pipfile['packages']
|
||||
assert 'six' in p.lockfile['default']
|
||||
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']
|
||||
assert "six" in p.pipfile["packages"]
|
||||
assert "six" in p.lockfile["default"]
|
||||
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
|
||||
@@ -137,7 +125,7 @@ def test_install_editable_git_tag(PipenvInstance, pip_src_dir, pypi):
|
||||
@pytest.mark.needs_internet
|
||||
def test_install_named_index_alias(PipenvInstance):
|
||||
with PipenvInstance() as p:
|
||||
with open(p.pipfile_path, 'w') as f:
|
||||
with open(p.pipfile_path, "w") as f:
|
||||
contents = """
|
||||
[[source]]
|
||||
url = "https://pypi.org/simple"
|
||||
@@ -155,7 +143,7 @@ six = "*"
|
||||
[dev-packages]
|
||||
""".strip()
|
||||
f.write(contents)
|
||||
c = p.pipenv('install pipenv-test-private-package --index testpypi')
|
||||
c = p.pipenv("install pipenv-test-private-package --index testpypi")
|
||||
assert c.return_code == 0
|
||||
|
||||
|
||||
@@ -164,23 +152,27 @@ six = "*"
|
||||
@pytest.mark.needs_internet
|
||||
def test_install_local_vcs_not_in_lockfile(PipenvInstance, pip_src_dir):
|
||||
with PipenvInstance(chdir=True) as p:
|
||||
six_path = os.path.join(p.path, 'six')
|
||||
c = delegator.run('git clone https://github.com/benjaminp/six.git {0}'.format(six_path))
|
||||
six_path = os.path.join(p.path, "six")
|
||||
c = delegator.run(
|
||||
"git clone https://github.com/benjaminp/six.git {0}".format(six_path)
|
||||
)
|
||||
assert c.return_code == 0
|
||||
c = p.pipenv('install -e ./six')
|
||||
c = p.pipenv("install -e ./six")
|
||||
assert c.return_code == 0
|
||||
six_key = list(p.pipfile['packages'].keys())[0]
|
||||
c = p.pipenv('install -e git+https://github.com/requests/requests.git#egg=requests')
|
||||
six_key = list(p.pipfile["packages"].keys())[0]
|
||||
c = p.pipenv(
|
||||
"install -e git+https://github.com/requests/requests.git#egg=requests"
|
||||
)
|
||||
assert c.return_code == 0
|
||||
c = p.pipenv('lock')
|
||||
c = p.pipenv("lock")
|
||||
assert c.return_code == 0
|
||||
assert 'requests' in p.pipfile['packages']
|
||||
assert 'requests' in p.lockfile['default']
|
||||
assert "requests" in p.pipfile["packages"]
|
||||
assert "requests" in p.lockfile["default"]
|
||||
# This is the hash of ./six
|
||||
assert six_key in p.pipfile['packages']
|
||||
assert six_key in p.lockfile['default']
|
||||
assert six_key in p.pipfile["packages"]
|
||||
assert six_key in p.lockfile["default"]
|
||||
# The hash isn't a hash anymore, its actually the name of the package (we now resolve this)
|
||||
assert 'six' in p.pipfile['packages']
|
||||
assert "six" in p.pipfile["packages"]
|
||||
|
||||
|
||||
@pytest.mark.vcs
|
||||
@@ -188,19 +180,27 @@ def test_install_local_vcs_not_in_lockfile(PipenvInstance, pip_src_dir):
|
||||
@pytest.mark.needs_internet
|
||||
def test_get_vcs_refs(PipenvInstance, pip_src_dir):
|
||||
with PipenvInstance(chdir=True) as p:
|
||||
c = p.pipenv('install -e git+https://github.com/benjaminp/six.git@1.9.0#egg=six')
|
||||
c = p.pipenv(
|
||||
"install -e git+https://github.com/benjaminp/six.git@1.9.0#egg=six"
|
||||
)
|
||||
assert c.return_code == 0
|
||||
assert 'six' in p.pipfile['packages']
|
||||
assert 'six' in p.lockfile['default']
|
||||
assert p.lockfile['default']['six']['ref'] == '5efb522b0647f7467248273ec1b893d06b984a59'
|
||||
assert "six" in p.pipfile["packages"]
|
||||
assert "six" in p.lockfile["default"]
|
||||
assert (
|
||||
p.lockfile["default"]["six"]["ref"]
|
||||
== "5efb522b0647f7467248273ec1b893d06b984a59"
|
||||
)
|
||||
pipfile = Path(p.pipfile_path)
|
||||
new_content = pipfile.read_bytes().replace(b'1.9.0', b'1.11.0')
|
||||
new_content = pipfile.read_bytes().replace(b"1.9.0", b"1.11.0")
|
||||
pipfile.write_bytes(new_content)
|
||||
c = p.pipenv('lock')
|
||||
c = p.pipenv("lock")
|
||||
assert c.return_code == 0
|
||||
assert p.lockfile['default']['six']['ref'] == '15e31431af97e5e64b80af0a3f598d382bcdd49a'
|
||||
assert 'six' in p.pipfile['packages']
|
||||
assert 'six' in p.lockfile['default']
|
||||
assert (
|
||||
p.lockfile["default"]["six"]["ref"]
|
||||
== "15e31431af97e5e64b80af0a3f598d382bcdd49a"
|
||||
)
|
||||
assert "six" in p.pipfile["packages"]
|
||||
assert "six" in p.lockfile["default"]
|
||||
|
||||
|
||||
@pytest.mark.vcs
|
||||
@@ -212,8 +212,9 @@ def test_vcs_entry_supersedes_non_vcs(PipenvInstance, pip_src_dir):
|
||||
the resolution graph of non-editable vcs dependencies.
|
||||
"""
|
||||
with PipenvInstance(chdir=True) as p:
|
||||
with open(p.pipfile_path, 'w') as f:
|
||||
f.write("""
|
||||
with open(p.pipfile_path, "w") as f:
|
||||
f.write(
|
||||
"""
|
||||
[[source]]
|
||||
url = "https://pypi.org/simple"
|
||||
verify_ssl = true
|
||||
@@ -222,11 +223,15 @@ name = "pypi"
|
||||
[packages]
|
||||
PyUpdater = "*"
|
||||
PyInstaller = {ref = "develop", git = "https://github.com/pyinstaller/pyinstaller.git"}
|
||||
""".strip())
|
||||
p.pipenv('install')
|
||||
installed_packages = ['PyUpdater', 'PyInstaller']
|
||||
assert all([k in p.pipfile['packages'] for k in installed_packages])
|
||||
assert all([k.lower() in p.lockfile['default'] for k in installed_packages])
|
||||
assert all([k in p.lockfile['default']['pyinstaller'] for k in ['ref', 'git']])
|
||||
assert p.lockfile['default']['pyinstaller'].get('ref') is not None
|
||||
assert p.lockfile['default']['pyinstaller']['git'] == "https://github.com/pyinstaller/pyinstaller.git"
|
||||
""".strip()
|
||||
)
|
||||
p.pipenv("install")
|
||||
installed_packages = ["PyUpdater", "PyInstaller"]
|
||||
assert all([k in p.pipfile["packages"] for k in installed_packages])
|
||||
assert all([k.lower() in p.lockfile["default"] for k in installed_packages])
|
||||
assert all([k in p.lockfile["default"]["pyinstaller"] for k in ["ref", "git"]])
|
||||
assert p.lockfile["default"]["pyinstaller"].get("ref") is not None
|
||||
assert (
|
||||
p.lockfile["default"]["pyinstaller"]["git"]
|
||||
== "https://github.com/pyinstaller/pyinstaller.git"
|
||||
)
|
||||
|
||||
@@ -11,25 +11,25 @@ import pytest
|
||||
@pytest.mark.install
|
||||
def test_uninstall(PipenvInstance, pypi):
|
||||
with PipenvInstance(pypi=pypi) as p:
|
||||
c = p.pipenv('install requests')
|
||||
c = p.pipenv("install requests")
|
||||
assert c.return_code == 0
|
||||
assert 'requests' in p.pipfile['packages']
|
||||
assert 'requests' in p.lockfile['default']
|
||||
assert 'chardet' in p.lockfile['default']
|
||||
assert 'idna' in p.lockfile['default']
|
||||
assert 'urllib3' in p.lockfile['default']
|
||||
assert 'certifi' in p.lockfile['default']
|
||||
assert "requests" in p.pipfile["packages"]
|
||||
assert "requests" in p.lockfile["default"]
|
||||
assert "chardet" in p.lockfile["default"]
|
||||
assert "idna" in p.lockfile["default"]
|
||||
assert "urllib3" in p.lockfile["default"]
|
||||
assert "certifi" in p.lockfile["default"]
|
||||
|
||||
c = p.pipenv('uninstall requests')
|
||||
c = p.pipenv("uninstall requests")
|
||||
assert c.return_code == 0
|
||||
assert 'requests' not in p.pipfile['dev-packages']
|
||||
assert 'requests' not in p.lockfile['develop']
|
||||
assert 'chardet' not in p.lockfile['develop']
|
||||
assert 'idna' not in p.lockfile['develop']
|
||||
assert 'urllib3' not in p.lockfile['develop']
|
||||
assert 'certifi' not in p.lockfile['develop']
|
||||
assert "requests" not in p.pipfile["dev-packages"]
|
||||
assert "requests" not in p.lockfile["develop"]
|
||||
assert "chardet" not in p.lockfile["develop"]
|
||||
assert "idna" not in p.lockfile["develop"]
|
||||
assert "urllib3" not in p.lockfile["develop"]
|
||||
assert "certifi" not in p.lockfile["develop"]
|
||||
|
||||
c = p.pipenv('run python -m requests.help')
|
||||
c = p.pipenv("run python -m requests.help")
|
||||
assert c.return_code > 0
|
||||
|
||||
|
||||
@@ -39,38 +39,40 @@ def test_uninstall(PipenvInstance, pypi):
|
||||
def test_mirror_uninstall(PipenvInstance, pypi):
|
||||
with temp_environ(), PipenvInstance(chdir=True) as p:
|
||||
|
||||
mirror_url = os.environ.pop('PIPENV_TEST_INDEX', "https://pypi.python.org/simple")
|
||||
assert 'pypi.org' not in mirror_url
|
||||
mirror_url = os.environ.pop(
|
||||
"PIPENV_TEST_INDEX", "https://pypi.python.org/simple"
|
||||
)
|
||||
assert "pypi.org" not in mirror_url
|
||||
|
||||
c = p.pipenv('install requests --pypi-mirror {0}'.format(mirror_url))
|
||||
c = p.pipenv("install requests --pypi-mirror {0}".format(mirror_url))
|
||||
assert c.return_code == 0
|
||||
assert 'requests' in p.pipfile['packages']
|
||||
assert 'requests' in p.lockfile['default']
|
||||
assert 'chardet' in p.lockfile['default']
|
||||
assert 'idna' in p.lockfile['default']
|
||||
assert 'urllib3' in p.lockfile['default']
|
||||
assert 'certifi' in p.lockfile['default']
|
||||
assert "requests" in p.pipfile["packages"]
|
||||
assert "requests" in p.lockfile["default"]
|
||||
assert "chardet" in p.lockfile["default"]
|
||||
assert "idna" in p.lockfile["default"]
|
||||
assert "urllib3" in p.lockfile["default"]
|
||||
assert "certifi" in p.lockfile["default"]
|
||||
# Ensure the --pypi-mirror parameter hasn't altered the Pipfile or Pipfile.lock sources
|
||||
assert len(p.pipfile['source']) == 1
|
||||
assert len(p.pipfile["source"]) == 1
|
||||
assert len(p.lockfile["_meta"]["sources"]) == 1
|
||||
assert 'https://pypi.org/simple' == p.pipfile['source'][0]['url']
|
||||
assert 'https://pypi.org/simple' == p.lockfile['_meta']['sources'][0]['url']
|
||||
assert "https://pypi.org/simple" == p.pipfile["source"][0]["url"]
|
||||
assert "https://pypi.org/simple" == p.lockfile["_meta"]["sources"][0]["url"]
|
||||
|
||||
c = p.pipenv('uninstall requests --pypi-mirror {0}'.format(mirror_url))
|
||||
c = p.pipenv("uninstall requests --pypi-mirror {0}".format(mirror_url))
|
||||
assert c.return_code == 0
|
||||
assert 'requests' not in p.pipfile['dev-packages']
|
||||
assert 'requests' not in p.lockfile['develop']
|
||||
assert 'chardet' not in p.lockfile['develop']
|
||||
assert 'idna' not in p.lockfile['develop']
|
||||
assert 'urllib3' not in p.lockfile['develop']
|
||||
assert 'certifi' not in p.lockfile['develop']
|
||||
assert "requests" not in p.pipfile["dev-packages"]
|
||||
assert "requests" not in p.lockfile["develop"]
|
||||
assert "chardet" not in p.lockfile["develop"]
|
||||
assert "idna" not in p.lockfile["develop"]
|
||||
assert "urllib3" not in p.lockfile["develop"]
|
||||
assert "certifi" not in p.lockfile["develop"]
|
||||
# Ensure the --pypi-mirror parameter hasn't altered the Pipfile or Pipfile.lock sources
|
||||
assert len(p.pipfile['source']) == 1
|
||||
assert len(p.pipfile["source"]) == 1
|
||||
assert len(p.lockfile["_meta"]["sources"]) == 1
|
||||
assert 'https://pypi.org/simple' == p.pipfile['source'][0]['url']
|
||||
assert 'https://pypi.org/simple' == p.lockfile['_meta']['sources'][0]['url']
|
||||
assert "https://pypi.org/simple" == p.pipfile["source"][0]["url"]
|
||||
assert "https://pypi.org/simple" == p.lockfile["_meta"]["sources"][0]["url"]
|
||||
|
||||
c = p.pipenv('run python -m requests.help')
|
||||
c = p.pipenv("run python -m requests.help")
|
||||
assert c.return_code > 0
|
||||
|
||||
|
||||
@@ -78,19 +80,19 @@ def test_mirror_uninstall(PipenvInstance, pypi):
|
||||
@pytest.mark.uninstall
|
||||
@pytest.mark.install
|
||||
def test_uninstall_all_local_files(PipenvInstance, testsroot):
|
||||
file_name = 'tablib-0.12.1.tar.gz'
|
||||
file_name = "requests-2.19.1.tar.gz"
|
||||
# Not sure where travis/appveyor run tests from
|
||||
source_path = os.path.abspath(os.path.join(testsroot, 'test_artifacts', file_name))
|
||||
source_path = os.path.abspath(os.path.join(testsroot, "test_artifacts", file_name))
|
||||
|
||||
with PipenvInstance() as p:
|
||||
shutil.copy(source_path, os.path.join(p.path, file_name))
|
||||
os.mkdir(os.path.join(p.path, "tablib"))
|
||||
c = p.pipenv('install {}'.format(file_name))
|
||||
os.mkdir(os.path.join(p.path, "requests"))
|
||||
c = p.pipenv("install {}".format(file_name))
|
||||
assert c.return_code == 0
|
||||
c = p.pipenv('uninstall --all')
|
||||
c = p.pipenv("uninstall --all")
|
||||
assert c.return_code == 0
|
||||
assert 'tablib' in c.out
|
||||
assert 'tablib' not in p.pipfile['packages']
|
||||
assert "requests" in c.out
|
||||
assert "requests" not in p.pipfile["packages"]
|
||||
|
||||
|
||||
@pytest.mark.run
|
||||
@@ -98,29 +100,29 @@ def test_uninstall_all_local_files(PipenvInstance, testsroot):
|
||||
@pytest.mark.install
|
||||
def test_uninstall_all_dev(PipenvInstance, pypi):
|
||||
with PipenvInstance(pypi=pypi) as p:
|
||||
c = p.pipenv('install --dev requests six')
|
||||
c = p.pipenv("install --dev requests six")
|
||||
assert c.return_code == 0
|
||||
|
||||
c = p.pipenv('install pytz')
|
||||
c = p.pipenv("install pytz")
|
||||
assert c.return_code == 0
|
||||
|
||||
assert 'pytz' in p.pipfile['packages']
|
||||
assert 'requests' in p.pipfile['dev-packages']
|
||||
assert 'six' in p.pipfile['dev-packages']
|
||||
assert 'pytz' in p.lockfile['default']
|
||||
assert 'requests' in p.lockfile['develop']
|
||||
assert 'six' in p.lockfile['develop']
|
||||
assert "pytz" in p.pipfile["packages"]
|
||||
assert "requests" in p.pipfile["dev-packages"]
|
||||
assert "six" in p.pipfile["dev-packages"]
|
||||
assert "pytz" in p.lockfile["default"]
|
||||
assert "requests" in p.lockfile["develop"]
|
||||
assert "six" in p.lockfile["develop"]
|
||||
|
||||
c = p.pipenv('uninstall --all-dev')
|
||||
c = p.pipenv("uninstall --all-dev")
|
||||
assert c.return_code == 0
|
||||
assert 'requests' not in p.pipfile['dev-packages']
|
||||
assert 'six' not in p.pipfile['dev-packages']
|
||||
assert 'requests' not in p.lockfile['develop']
|
||||
assert 'six' not in p.lockfile['develop']
|
||||
assert 'pytz' in p.pipfile['packages']
|
||||
assert 'pytz' in p.lockfile['default']
|
||||
assert "requests" not in p.pipfile["dev-packages"]
|
||||
assert "six" not in p.pipfile["dev-packages"]
|
||||
assert "requests" not in p.lockfile["develop"]
|
||||
assert "six" not in p.lockfile["develop"]
|
||||
assert "pytz" in p.pipfile["packages"]
|
||||
assert "pytz" in p.lockfile["default"]
|
||||
|
||||
c = p.pipenv('run python -m requests.help')
|
||||
c = p.pipenv("run python -m requests.help")
|
||||
assert c.return_code > 0
|
||||
|
||||
c = p.pipenv('run python -c "import pytz"')
|
||||
@@ -131,7 +133,7 @@ def test_uninstall_all_dev(PipenvInstance, pypi):
|
||||
@pytest.mark.run
|
||||
def test_normalize_name_uninstall(PipenvInstance, pypi):
|
||||
with PipenvInstance(pypi=pypi) as p:
|
||||
with open(p.pipfile_path, 'w') as f:
|
||||
with open(p.pipfile_path, "w") as f:
|
||||
contents = """
|
||||
# Pre comment
|
||||
[packages]
|
||||
@@ -140,12 +142,12 @@ python_DateUtil = "*" # Inline comment
|
||||
"""
|
||||
f.write(contents)
|
||||
|
||||
c = p.pipenv('install')
|
||||
c = p.pipenv("install")
|
||||
assert c.return_code == 0
|
||||
|
||||
c = p.pipenv('uninstall python_dateutil')
|
||||
assert 'Requests' in p.pipfile['packages']
|
||||
assert 'python_DateUtil' not in p.pipfile['packages']
|
||||
c = p.pipenv("uninstall python_dateutil")
|
||||
assert "Requests" in p.pipfile["packages"]
|
||||
assert "python_DateUtil" not in p.pipfile["packages"]
|
||||
contents = open(p.pipfile_path).read()
|
||||
assert '# Pre comment' in contents
|
||||
assert '# Inline comment' in contents
|
||||
assert "# Pre comment" in contents
|
||||
assert "# Inline comment" in contents
|
||||
|
||||
@@ -1,2 +1 @@
|
||||
requests==2.18.4
|
||||
records==0.5.2
|
||||
|
||||
Reference in New Issue
Block a user