File tree Expand file tree Collapse file tree 3 files changed +36
-0
lines changed Expand file tree Collapse file tree 3 files changed +36
-0
lines changed Original file line number Diff line number Diff line change
1
+ Fix issue parsing some Pipfiles with separate packages.<pkg> sections (tomlkit OutOfOrderTableProxy)
Original file line number Diff line number Diff line change @@ -36,6 +36,8 @@ def convert_tomlkit_table(section):
36
36
result = section .copy ()
37
37
if isinstance (section , tomlkit .items .Table ):
38
38
body = section .value ._body
39
+ elif isinstance (section , tomlkit .container .OutOfOrderTableProxy ):
40
+ body = section ._internal_container ._body
39
41
else :
40
42
body = section ._body
41
43
for key , value in body :
Original file line number Diff line number Diff line change @@ -451,6 +451,39 @@ def test_rewrite_outline_table(pipenv_instance_private_pypi):
451
451
assert 'colorama = "*"' in contents
452
452
453
453
454
+ @pytest .mark .basic
455
+ @pytest .mark .install
456
+ def test_rewrite_outline_table_ooo (pipenv_instance_private_pypi ):
457
+ with pipenv_instance_private_pypi () as p :
458
+ with open (p .pipfile_path , 'w' ) as f :
459
+ contents = """
460
+ [[source]]
461
+ url = "{}"
462
+ verify_ssl = false
463
+ name = "testindex"
464
+
465
+ [packages]
466
+ six = {}
467
+
468
+ # Out-of-order
469
+ [pipenv]
470
+ allow_prereleases = false
471
+
472
+ [packages.requests]
473
+ version = "*"
474
+ extras = ["socks"]
475
+ """ .format (p .index_url , "{version = \" *\" }" ).strip ()
476
+ f .write (contents )
477
+ c = p .pipenv ("install colorama" )
478
+ assert c .returncode == 0
479
+ with open (p .pipfile_path ) as f :
480
+ contents = f .read ()
481
+ assert "[packages.requests]" not in contents
482
+ assert 'six = {version = "*"}' in contents
483
+ assert 'requests = {version = "*"' in contents
484
+ assert 'colorama = "*"' in contents
485
+
486
+
454
487
@pytest .mark .dev
455
488
@pytest .mark .install
456
489
def test_install_dev_use_default_constraints (pipenv_instance_private_pypi ):
You can’t perform that action at this time.
0 commit comments