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

#4278: Don't pin wildcard versions in lockfile #4283

Merged
merged 1 commit into from
May 29, 2020
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
1 change: 1 addition & 0 deletions news/4278.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix a bug that caused non-specific versions to be pinned in ``Pipfile.lock``.
2 changes: 1 addition & 1 deletion pipenv/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -1191,7 +1191,7 @@ def get_locked_dep(dep, pipfile_section, prefer_pipfile=True):
lockfile_name, lockfile_dict = lockfile_entry.copy().popitem()
lockfile_version = lockfile_dict.get("version", "")
# Keep pins from the lockfile
if prefer_pipfile and lockfile_version != version and version.startswith("=="):
if prefer_pipfile and lockfile_version != version and version.startswith("==") and "*" not in version:
lockfile_dict["version"] = version
lockfile_entry[lockfile_name] = lockfile_dict
return lockfile_entry
Expand Down
13 changes: 13 additions & 0 deletions tests/integration/test_lock.py
Original file line number Diff line number Diff line change
Expand Up @@ -748,3 +748,16 @@ def test_lock_nested_vcs_direct_url(PipenvInstance):
assert "git" in p.lockfile["default"]["sibling-package"]
assert "subdirectory" in p.lockfile["default"]["sibling-package"]
assert "version" not in p.lockfile["default"]["sibling-package"]


@pytest.mark.lock
@pytest.mark.install
def test_lock_package_with_wildcard_version(PipenvInstance):
with PipenvInstance(chdir=True) as p:
c = p.pipenv("install 'six==1.11.*'")
assert c.ok
assert "six" in p.pipfile["packages"]
assert p.pipfile["packages"]["six"] == "==1.11.*"
assert "six" in p.lockfile["default"]
assert "version" in p.lockfile["default"]["six"]
assert p.lockfile["default"]["six"]["version"] == "==1.11.0"