mirror of
https://github.com/kennethreitz/pipenv.git
synced 2026-06-05 14:50:16 +00:00
Merge pull request #4554 from Isheros/issue-4141
Fix for: --skip-lock: tomlkit.exceptions.NonExistentKey: 'Key "source" does not exist
This commit is contained in:
@@ -0,0 +1 @@
|
||||
Fix a bug where passing --skip-lock when PIPFILE has no [SOURCE] section throws the error: "tomlkit.exceptions.NonExistentKey: 'Key "source" does not exist.'"
|
||||
+3
-1
@@ -821,8 +821,10 @@ class Project(object):
|
||||
from .vendor.plette.lockfiles import PIPFILE_SPEC_CURRENT
|
||||
if self.lockfile_exists:
|
||||
sources = self.lockfile_content.get("_meta", {}).get("sources", [])
|
||||
else:
|
||||
elif "source" in self.parsed_pipfile:
|
||||
sources = [dict(source) for source in self.parsed_pipfile["source"]]
|
||||
else:
|
||||
sources = self.pipfile_sources
|
||||
if not isinstance(sources, list):
|
||||
sources = [sources]
|
||||
return {
|
||||
|
||||
@@ -230,3 +230,17 @@ def test_run_in_virtualenv(PipenvInstance):
|
||||
c = p.pipenv("clean --dry-run")
|
||||
assert c.return_code == 0
|
||||
assert "click" in c.out
|
||||
|
||||
@pytest.mark.project
|
||||
@pytest.mark.sources
|
||||
def test_no_sources_in_pipfile(PipenvInstance):
|
||||
with PipenvInstance(chdir=True) as p:
|
||||
with open(p.pipfile_path, 'w') as f:
|
||||
contents = """
|
||||
[packages]
|
||||
pytest = "*"
|
||||
""".format(os.environ['PIPENV_TEST_INDEX']).strip()
|
||||
f.write(contents)
|
||||
c = p.pipenv('install --skip-lock')
|
||||
assert c.return_code == 0
|
||||
|
||||
|
||||
Reference in New Issue
Block a user