mirror of
https://github.com/kennethreitz/pipenv.git
synced 2026-06-05 22:50:18 +00:00
utils.toml: Handle tomlkit OutOfOrderTableProxy (#5797)
We get this when we have subtables that do not directly follow their parent table. Fixes: #5794 Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
This commit is contained in:
committed by
GitHub
parent
00b622a169
commit
7085c79cdb
@@ -0,0 +1 @@
|
||||
Fix issue parsing some Pipfiles with separate packages.<pkg> sections (tomlkit OutOfOrderTableProxy)
|
||||
@@ -36,6 +36,8 @@ def convert_toml_outline_tables(parsed, project):
|
||||
result = section.copy()
|
||||
if isinstance(section, tomlkit.items.Table):
|
||||
body = section.value._body
|
||||
elif isinstance(section, tomlkit.container.OutOfOrderTableProxy):
|
||||
body = section._internal_container._body
|
||||
else:
|
||||
body = section._body
|
||||
for key, value in body:
|
||||
|
||||
@@ -451,6 +451,39 @@ extras = ["socks"]
|
||||
assert 'colorama = "*"' in contents
|
||||
|
||||
|
||||
@pytest.mark.basic
|
||||
@pytest.mark.install
|
||||
def test_rewrite_outline_table_ooo(pipenv_instance_private_pypi):
|
||||
with pipenv_instance_private_pypi() as p:
|
||||
with open(p.pipfile_path, 'w') as f:
|
||||
contents = """
|
||||
[[source]]
|
||||
url = "{}"
|
||||
verify_ssl = false
|
||||
name = "testindex"
|
||||
|
||||
[packages]
|
||||
six = {}
|
||||
|
||||
# Out-of-order
|
||||
[pipenv]
|
||||
allow_prereleases = false
|
||||
|
||||
[packages.requests]
|
||||
version = "*"
|
||||
extras = ["socks"]
|
||||
""".format(p.index_url, "{version = \"*\"}").strip()
|
||||
f.write(contents)
|
||||
c = p.pipenv("install colorama")
|
||||
assert c.returncode == 0
|
||||
with open(p.pipfile_path) as f:
|
||||
contents = f.read()
|
||||
assert "[packages.requests]" not in contents
|
||||
assert 'six = {version = "*"}' in contents
|
||||
assert 'requests = {version = "*"' in contents
|
||||
assert 'colorama = "*"' in contents
|
||||
|
||||
|
||||
@pytest.mark.dev
|
||||
@pytest.mark.install
|
||||
def test_install_dev_use_default_constraints(pipenv_instance_private_pypi):
|
||||
|
||||
Reference in New Issue
Block a user