Merge branch 'master' into fix-pipenv-clean

This commit is contained in:
Dan Ryan
2018-10-09 22:33:03 -04:00
committed by GitHub
3 changed files with 31 additions and 4 deletions
+1
View File
@@ -0,0 +1 @@
Fix parsing of outline tables.
+5 -4
View File
@@ -496,14 +496,15 @@ class Project(object):
# Convert things to inline tables — fancy :)
if hasattr(data[section][package], "keys"):
_data = data[section][package]
data[section][package] = toml._get_empty_inline_table(dict)
data[section][package] = toml.TomlDecoder().get_empty_inline_table()
data[section][package].update(_data)
toml_encoder = toml.TomlEncoder(preserve=True)
# We lose comments here, but it's for the best.)
try:
return contoml.loads(toml.dumps(data, preserve=True))
return contoml.loads(toml.dumps(data, encoder=toml_encoder))
except RuntimeError:
return toml.loads(toml.dumps(data, preserve=True))
return toml.loads(toml.dumps(data, encoder=toml_encoder))
else:
# Fallback to toml parser, for large files.
@@ -692,7 +693,7 @@ class Project(object):
# Convert things to inline tables — fancy :)
if hasattr(data[section][package], "keys"):
_data = data[section][package]
data[section][package] = toml._get_empty_inline_table(dict)
data[section][package] = toml.TomlDecoder().get_empty_inline_table()
data[section][package].update(_data)
formatted_data = toml.dumps(data).rstrip()
+25
View File
@@ -232,6 +232,31 @@ requests = {version = "*"}
assert c.return_code == 0
@pytest.mark.run
@pytest.mark.alt
@flaky
def test_outline_table_specifier(PipenvInstance, pypi):
with PipenvInstance(pypi=pypi) as p:
with open(p.pipfile_path, "w") as f:
contents = """
[packages.requests]
version = "*"
""".strip()
f.write(contents)
c = p.pipenv("install")
assert c.return_code == 0
assert "requests" in p.lockfile["default"]
assert "idna" in p.lockfile["default"]
assert "urllib3" in p.lockfile["default"]
assert "certifi" in p.lockfile["default"]
assert "chardet" in p.lockfile["default"]
c = p.pipenv('run python -c "import requests; import idna; import certifi;"')
assert c.return_code == 0
@pytest.mark.bad
@pytest.mark.install
def test_bad_packages(PipenvInstance, pypi):