Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch all update workflows to pipenv lock/sync #2379

Merged
merged 3 commits into from
Jun 18, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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]