From ba9f5057b8505c2d7e5d842bfad0117cb0f04613 Mon Sep 17 00:00:00 2001 From: Frost Ming Date: Wed, 9 Jan 2019 10:07:26 +0800 Subject: [PATCH] Populate source when getting lockfile --- news/3427.bugfix.rst | 1 + pipenv/project.py | 2 +- tests/integration/test_lock.py | 3 +++ 3 files changed, 5 insertions(+), 1 deletion(-) create mode 100644 news/3427.bugfix.rst diff --git a/news/3427.bugfix.rst b/news/3427.bugfix.rst new file mode 100644 index 00000000..42f659f0 --- /dev/null +++ b/news/3427.bugfix.rst @@ -0,0 +1 @@ +Fix a bug that ``ValidationError`` is thrown when some fields are missing in source section. diff --git a/pipenv/project.py b/pipenv/project.py index e8550a04..edbcff87 100644 --- a/pipenv/project.py +++ b/pipenv/project.py @@ -780,7 +780,7 @@ class Project(object): 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", {}) } diff --git a/tests/integration/test_lock.py b/tests/integration/test_lock.py index ab5178a0..75095ac0 100644 --- a/tests/integration/test_lock.py +++ b/tests/integration/test_lock.py @@ -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: @@ -502,6 +503,8 @@ url = "https://test.pypi.org/simple" [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']