From ac853d055263913faf9467517c5320ebf600eb8e Mon Sep 17 00:00:00 2001 From: Dan Ryan Date: Mon, 18 Jun 2018 03:35:19 -0400 Subject: [PATCH 1/3] Switch all update workflows to `pipenv lock/sync` - `pipenv update` currently doesn't actually run `pipenv lock` - Semantics around this changed but it doesn't look like the code did - `pipenv update` should operate similarly for all operations by running `lock` followed by `sync` - Fixes #2179 Signed-off-by: Dan Ryan --- pipenv/cli.py | 58 ++++++++++++++++----------------------------------- 1 file changed, 18 insertions(+), 40 deletions(-) diff --git a/pipenv/cli.py b/pipenv/cli.py index 4839411e..27bf7d40 100644 --- a/pipenv/cli.py +++ b/pipenv/cli.py @@ -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: @@ -853,28 +835,24 @@ 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, + 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, + ) @command( From 1c049606532d6d069b3330b4510bb6efe86aecae Mon Sep 17 00:00:00 2001 From: Dan Ryan Date: Mon, 18 Jun 2018 04:10:08 -0400 Subject: [PATCH 2/3] Add test to verify `pipenv update` Signed-off-by: Dan Ryan --- tests/integration/test_pipenv.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/tests/integration/test_pipenv.py b/tests/integration/test_pipenv.py index 3d8a197b..00f291e2 100644 --- a/tests/integration/test_pipenv.py +++ b/tests/integration/test_pipenv.py @@ -58,3 +58,24 @@ requests = "==2.14.0" 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] From 0ce5b3cb22b75de06197c586345a1074edc1af17 Mon Sep 17 00:00:00 2001 From: Dan Ryan Date: Mon, 18 Jun 2018 11:40:00 -0400 Subject: [PATCH 3/3] Remove some unused arguments during passthrough Signed-off-by: Dan Ryan --- pipenv/cli.py | 2 -- pipenv/core.py | 2 -- 2 files changed, 4 deletions(-) diff --git a/pipenv/cli.py b/pipenv/cli.py index 27bf7d40..91abc522 100644 --- a/pipenv/cli.py +++ b/pipenv/cli.py @@ -840,7 +840,6 @@ def update( ) do_sync( ctx=ctx, - install=install, dev=dev, three=three, python=python, @@ -977,7 +976,6 @@ def sync( do_sync( ctx=ctx, - install=install, dev=dev, three=three, python=python, diff --git a/pipenv/core.py b/pipenv/core.py index 321ec588..be67c8f5 100644 --- a/pipenv/core.py +++ b/pipenv/core.py @@ -2535,11 +2535,9 @@ def do_graph(bare=False, json=False, json_tree=False, reverse=False): def do_sync( ctx, - install, dev=False, three=None, python=None, - dry_run=False, bare=False, dont_upgrade=False, user=False,