Skip to content

Commit

Permalink
Merge pull request #2379 from pypa/2179-pipenv-update
Browse files Browse the repository at this point in the history
Switch all update workflows to `pipenv lock/sync`
  • Loading branch information
techalchemy authored Jun 18, 2018
2 parents 25e9325 + 0ce5b3c commit d213e7c
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 43 deletions.
58 changes: 17 additions & 41 deletions pipenv/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -823,24 +823,6 @@ def update(
crayons.white('.', bold=True),
)
)
do_lock(
verbose=verbose, clear=clear, pre=pre, keep_outdated=keep_outdated, pypi_mirror=pypi_mirror
)
do_sync(
ctx=ctx,
install=install,
dev=dev,
three=three,
python=python,
bare=bare,
dont_upgrade=False,
user=False,
verbose=verbose,
clear=clear,
unused=False,
sequential=sequential,
pypi_mirror=pypi_mirror,
)
else:
for package in ([package] + list(more_packages) or []):
if package not in project.all_packages:
Expand All @@ -853,28 +835,23 @@ def update(
err=True,
)
sys.exit(1)
ensure_lockfile(keep_outdated=project.lockfile_exists, pypi_mirror=pypi_mirror)
# Install the dependencies.
do_install(
package_name=package,
more_packages=more_packages,
dev=dev,
three=three,
python=python,
pypi_mirror=pypi_mirror,
system=system,
lock=True,
ignore_pipfile=False,
skip_lock=False,
verbose=verbose,
requirements=False,
sequential=sequential,
pre=pre,
code=False,
deploy=False,
keep_outdated=True,
selective_upgrade=True,
)
do_lock(
verbose=verbose, clear=clear, pre=pre, keep_outdated=keep_outdated, pypi_mirror=pypi_mirror
)
do_sync(
ctx=ctx,
dev=dev,
three=three,
python=python,
bare=bare,
dont_upgrade=False,
user=False,
verbose=verbose,
clear=clear,
unused=False,
sequential=sequential,
pypi_mirror=pypi_mirror,
)


@command(
Expand Down Expand Up @@ -999,7 +976,6 @@ def sync(

do_sync(
ctx=ctx,
install=install,
dev=dev,
three=three,
python=python,
Expand Down
2 changes: 0 additions & 2 deletions pipenv/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -2535,11 +2535,9 @@ def traverse(obj):

def do_sync(
ctx,
install,
dev=False,
three=None,
python=None,
dry_run=False,
bare=False,
dont_upgrade=False,
user=False,
Expand Down
21 changes: 21 additions & 0 deletions tests/integration/test_pipenv.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,3 +58,24 @@ def test_deploy_works(PipenvInstance, pypi):

c = p.pipenv('install --deploy')
assert c.return_code > 0


@pytest.mark.update
@pytest.mark.lock
def test_update_locks(PipenvInstance, pypi):

with PipenvInstance(pypi=pypi) as p:
c = p.pipenv('install requests==2.14.0')
assert c.return_code == 0
with open(p.pipfile_path, 'r') as fh:
pipfile_contents = fh.read()
pipfile_contents = pipfile_contents.replace('==2.14.0', '*')
with open(p.pipfile_path, 'w') as fh:
fh.write(pipfile_contents)
c = p.pipenv('update requests')
assert c.return_code == 0
assert p.lockfile['default']['requests']['version'] == '==2.18.4'
c = p.pipenv('run pip freeze')
assert c.return_code == 0
lines = c.out.splitlines()
assert 'requests==2.18.4' in [l.strip() for l in lines]

0 comments on commit d213e7c

Please sign in to comment.