Skip to content

Commit

Permalink
Merge pull request #3431 from pypa/bugfix/3427
Browse files Browse the repository at this point in the history
Populate source when getting lockfile
  • Loading branch information
frostming authored Jan 11, 2019
2 parents 32981ac + 9cb66a8 commit 5695322
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions news/3427.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix a bug that ``ValidationError`` is thrown when some fields are missing in source section.
2 changes: 1 addition & 1 deletion pipenv/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -780,7 +780,7 @@ def get_lockfile_meta(self):
return {
"hash": {"sha256": self.calculate_pipfile_hash()},
"pipfile-spec": PIPFILE_SPEC_CURRENT,
"sources": sources,
"sources": [self.populate_source(s) for s in sources],
"requires": self.parsed_pipfile.get("requires", {})
}

Expand Down
3 changes: 3 additions & 0 deletions tests/integration/test_lock.py
Original file line number Diff line number Diff line change
Expand Up @@ -491,6 +491,7 @@ def test_lockfile_with_empty_dict(PipenvInstance):


@pytest.mark.lock
@pytest.mark.skip_lock
@pytest.mark.install
def test_lock_with_incomplete_source(PipenvInstance, pypi):
with PipenvInstance(pypi=pypi, chdir=True) as p:
Expand All @@ -502,6 +503,8 @@ def test_lock_with_incomplete_source(PipenvInstance, pypi):
[packages]
requests = "*"
""")
c = p.pipenv('install --skip-lock')
assert c.return_code == 0
c = p.pipenv('install')
assert c.return_code == 0
assert p.lockfile['_meta']['sources']
Expand Down

0 comments on commit 5695322

Please sign in to comment.