Skip to content

Commit f2b1739

Browse files
dimblebyneersighted
authored andcommitted
Use recent lockfile format in tests
1 parent d186c95 commit f2b1739

File tree

1 file changed

+83
-37
lines changed

1 file changed

+83
-37
lines changed

tests/test_exporter.py

Lines changed: 83 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ def test_exporter_can_export_requirements_txt_with_standard_packages(
131131
"metadata": {
132132
"python-versions": "*",
133133
"content-hash": "123456789",
134-
"hashes": {"foo": [], "bar": []},
134+
"files": {"foo": [], "bar": []},
135135
},
136136
}
137137
)
@@ -185,7 +185,7 @@ def test_exporter_can_export_requirements_txt_with_standard_packages_and_markers
185185
"metadata": {
186186
"python-versions": "*",
187187
"content-hash": "123456789",
188-
"hashes": {"foo": [], "bar": [], "baz": []},
188+
"files": {"foo": [], "bar": [], "baz": []},
189189
},
190190
}
191191
)
@@ -270,7 +270,7 @@ def test_exporter_can_export_requirements_txt_poetry(
270270
"metadata": {
271271
"python-versions": "*",
272272
"content-hash": "123456789",
273-
"hashes": {
273+
"files": {
274274
"poetry": [],
275275
"keyring": [],
276276
"secretstorage": [],
@@ -368,7 +368,7 @@ def test_exporter_can_export_requirements_txt_pyinstaller(
368368
"metadata": {
369369
"python-versions": "*",
370370
"content-hash": "123456789",
371-
"hashes": {"pyinstaller": [], "altgraph": [], "macholib": []},
371+
"files": {"pyinstaller": [], "altgraph": [], "macholib": []},
372372
},
373373
}
374374
)
@@ -453,7 +453,7 @@ def test_exporter_can_export_requirements_txt_with_nested_packages_and_markers(
453453
"metadata": {
454454
"python-versions": "*",
455455
"content-hash": "123456789",
456-
"hashes": {"a": [], "b": [], "c": [], "d": []},
456+
"files": {"a": [], "b": [], "c": [], "d": []},
457457
},
458458
}
459459
)
@@ -529,7 +529,7 @@ def test_exporter_can_export_requirements_txt_with_nested_packages_and_markers_a
529529
"metadata": {
530530
"python-versions": "*",
531531
"content-hash": "123456789",
532-
"hashes": {"a": [], "b": []},
532+
"files": {"a": [], "b": []},
533533
},
534534
}
535535
)
@@ -582,7 +582,10 @@ def test_exporter_can_export_requirements_txt_with_standard_packages_and_hashes(
582582
"metadata": {
583583
"python-versions": "*",
584584
"content-hash": "123456789",
585-
"hashes": {"foo": ["12345"], "bar": ["67890"]},
585+
"files": {
586+
"foo": [{"name": "foo.whl", "hash": "12345"}],
587+
"bar": [{"name": "bar.whl", "hash": "67890"}],
588+
},
586589
},
587590
}
588591
)
@@ -628,7 +631,16 @@ def test_exporter_can_export_requirements_txt_with_standard_packages_and_sorted_
628631
"metadata": {
629632
"python-versions": "*",
630633
"content-hash": "123456789",
631-
"hashes": {"foo": ["67890", "12345"], "bar": ["67890", "12345"]},
634+
"files": {
635+
"foo": [
636+
{"name": "foo1.whl", "hash": "67890"},
637+
{"name": "foo2.whl", "hash": "12345"},
638+
],
639+
"bar": [
640+
{"name": "bar1.whl", "hash": "67890"},
641+
{"name": "bar2.whl", "hash": "12345"},
642+
],
643+
},
632644
},
633645
}
634646
)
@@ -676,7 +688,10 @@ def test_exporter_requirements_txt_with_standard_packages_and_hashes_disabled(
676688
"metadata": {
677689
"python-versions": "*",
678690
"content-hash": "123456789",
679-
"hashes": {"foo": ["12345"], "bar": ["67890"]},
691+
"files": {
692+
"foo": [{"name": "foo.whl", "hash": "12345"}],
693+
"bar": [{"name": "bar.whl", "hash": "67890"}],
694+
},
680695
},
681696
}
682697
)
@@ -721,7 +736,10 @@ def test_exporter_exports_requirements_txt_without_dev_packages_by_default(
721736
"metadata": {
722737
"python-versions": "*",
723738
"content-hash": "123456789",
724-
"hashes": {"foo": ["12345"], "bar": ["67890"]},
739+
"files": {
740+
"foo": [{"name": "foo.whl", "hash": "12345"}],
741+
"bar": [{"name": "bar.whl", "hash": "67890"}],
742+
},
725743
},
726744
}
727745
)
@@ -765,7 +783,10 @@ def test_exporter_exports_requirements_txt_with_dev_packages_if_opted_in(
765783
"metadata": {
766784
"python-versions": "*",
767785
"content-hash": "123456789",
768-
"hashes": {"foo": ["12345"], "bar": ["67890"]},
786+
"files": {
787+
"foo": [{"name": "foo.whl", "hash": "12345"}],
788+
"bar": [{"name": "bar.whl", "hash": "67890"}],
789+
},
769790
},
770791
}
771792
)
@@ -812,7 +833,10 @@ def test_exporter_exports_requirements_txt_without_groups_if_set_explicity(
812833
"metadata": {
813834
"python-versions": "*",
814835
"content-hash": "123456789",
815-
"hashes": {"foo": ["12345"], "bar": ["67890"]},
836+
"files": {
837+
"foo": [{"name": "foo.whl", "hash": "12345"}],
838+
"bar": [{"name": "bar.whl", "hash": "67890"}],
839+
},
816840
},
817841
}
818842
)
@@ -852,7 +876,10 @@ def test_exporter_exports_requirements_txt_without_optional_packages(
852876
"metadata": {
853877
"python-versions": "*",
854878
"content-hash": "123456789",
855-
"hashes": {"foo": ["12345"], "bar": ["67890"]},
879+
"files": {
880+
"foo": [{"name": "foo.whl", "hash": "12345"}],
881+
"bar": [{"name": "bar.whl", "hash": "67890"}],
882+
},
856883
},
857884
}
858885
)
@@ -937,7 +964,11 @@ def test_exporter_exports_requirements_txt_with_optional_packages(
937964
"metadata": {
938965
"python-versions": "*",
939966
"content-hash": "123456789",
940-
"hashes": {"foo": ["12345"], "bar": ["67890"], "spam": ["abcde"]},
967+
"files": {
968+
"foo": [{"name": "foo.whl", "hash": "12345"}],
969+
"bar": [{"name": "bar.whl", "hash": "67890"}],
970+
"spam": [{"name": "spam.whl", "hash": "abcde"}],
971+
},
941972
},
942973
"extras": {"feature_bar": ["bar"]},
943974
}
@@ -984,7 +1015,7 @@ def test_exporter_can_export_requirements_txt_with_git_packages(
9841015
"metadata": {
9851016
"python-versions": "*",
9861017
"content-hash": "123456789",
987-
"hashes": {"foo": []},
1018+
"files": {"foo": []},
9881019
},
9891020
}
9901021
)
@@ -1038,7 +1069,7 @@ def test_exporter_can_export_requirements_txt_with_nested_packages(
10381069
"metadata": {
10391070
"python-versions": "*",
10401071
"content-hash": "123456789",
1041-
"hashes": {"foo": [], "bar": []},
1072+
"files": {"foo": [], "bar": []},
10421073
},
10431074
}
10441075
)
@@ -1092,7 +1123,7 @@ def test_exporter_can_export_requirements_txt_with_nested_packages_cyclic(
10921123
"metadata": {
10931124
"python-versions": "*",
10941125
"content-hash": "123456789",
1095-
"hashes": {"foo": [], "bar": [], "baz": []},
1126+
"files": {"foo": [], "bar": [], "baz": []},
10961127
},
10971128
}
10981129
)
@@ -1162,7 +1193,7 @@ def test_exporter_can_export_requirements_txt_with_nested_packages_and_multiple_
11621193
"metadata": {
11631194
"python-versions": "*",
11641195
"content-hash": "123456789",
1165-
"hashes": {"foo": [], "bar": [], "baz": []},
1196+
"files": {"foo": [], "bar": [], "baz": []},
11661197
},
11671198
}
11681199
)
@@ -1210,7 +1241,7 @@ def test_exporter_can_export_requirements_txt_with_git_packages_and_markers(
12101241
"metadata": {
12111242
"python-versions": "*",
12121243
"content-hash": "123456789",
1213-
"hashes": {"foo": []},
1244+
"files": {"foo": []},
12141245
},
12151246
}
12161247
)
@@ -1251,7 +1282,7 @@ def test_exporter_can_export_requirements_txt_with_directory_packages(
12511282
"metadata": {
12521283
"python-versions": "*",
12531284
"content-hash": "123456789",
1254-
"hashes": {"foo": []},
1285+
"files": {"foo": []},
12551286
},
12561287
}
12571288
)
@@ -1322,7 +1353,7 @@ def test_exporter_can_export_requirements_txt_with_nested_directory_packages(
13221353
"metadata": {
13231354
"python-versions": "*",
13241355
"content-hash": "123456789",
1325-
"hashes": {"foo": [], "bar": [], "baz": []},
1356+
"files": {"foo": [], "bar": [], "baz": []},
13261357
},
13271358
}
13281359
)
@@ -1367,7 +1398,7 @@ def test_exporter_can_export_requirements_txt_with_directory_packages_and_marker
13671398
"metadata": {
13681399
"python-versions": "*",
13691400
"content-hash": "123456789",
1370-
"hashes": {"foo": []},
1401+
"files": {"foo": []},
13711402
},
13721403
}
13731404
)
@@ -1409,7 +1440,7 @@ def test_exporter_can_export_requirements_txt_with_file_packages(
14091440
"metadata": {
14101441
"python-versions": "*",
14111442
"content-hash": "123456789",
1412-
"hashes": {"foo": []},
1443+
"files": {"foo": []},
14131444
},
14141445
}
14151446
)
@@ -1452,7 +1483,7 @@ def test_exporter_can_export_requirements_txt_with_file_packages_and_markers(
14521483
"metadata": {
14531484
"python-versions": "*",
14541485
"content-hash": "123456789",
1455-
"hashes": {"foo": []},
1486+
"files": {"foo": []},
14561487
},
14571488
}
14581489
)
@@ -1507,7 +1538,10 @@ def test_exporter_exports_requirements_txt_with_legacy_packages(
15071538
"metadata": {
15081539
"python-versions": "*",
15091540
"content-hash": "123456789",
1510-
"hashes": {"foo": ["12345"], "bar": ["67890"]},
1541+
"files": {
1542+
"foo": [{"name": "foo.whl", "hash": "12345"}],
1543+
"bar": [{"name": "bar.whl", "hash": "67890"}],
1544+
},
15111545
},
15121546
}
15131547
)
@@ -1567,7 +1601,10 @@ def test_exporter_exports_requirements_txt_with_url_false(
15671601
"metadata": {
15681602
"python-versions": "*",
15691603
"content-hash": "123456789",
1570-
"hashes": {"foo": ["12345"], "bar": ["67890"]},
1604+
"files": {
1605+
"foo": [{"name": "foo.whl", "hash": "12345"}],
1606+
"bar": [{"name": "bar.whl", "hash": "67890"}],
1607+
},
15711608
},
15721609
}
15731610
)
@@ -1619,7 +1656,9 @@ def test_exporter_exports_requirements_txt_with_legacy_packages_trusted_host(
16191656
"metadata": {
16201657
"python-versions": "*",
16211658
"content-hash": "123456789",
1622-
"hashes": {"bar": ["67890"]},
1659+
"files": {
1660+
"bar": [{"name": "bar.whl", "hash": "67890"}],
1661+
},
16231662
},
16241663
}
16251664
)
@@ -1701,7 +1740,7 @@ def test_exporter_exports_requirements_txt_with_dev_extras(
17011740
"metadata": {
17021741
"python-versions": "*",
17031742
"content-hash": "123456789",
1704-
"hashes": {"foo": [], "bar": [], "baz": []},
1743+
"files": {"foo": [], "bar": [], "baz": []},
17051744
},
17061745
}
17071746
)
@@ -1776,7 +1815,11 @@ def test_exporter_exports_requirements_txt_with_legacy_packages_and_duplicate_so
17761815
"metadata": {
17771816
"python-versions": "*",
17781817
"content-hash": "123456789",
1779-
"hashes": {"foo": ["12345"], "bar": ["67890"], "baz": ["24680"]},
1818+
"files": {
1819+
"foo": [{"name": "foo.whl", "hash": "12345"}],
1820+
"bar": [{"name": "bar.whl", "hash": "67890"}],
1821+
"baz": [{"name": "baz.whl", "hash": "24680"}],
1822+
},
17801823
},
17811824
}
17821825
)
@@ -1842,7 +1885,10 @@ def test_exporter_exports_requirements_txt_with_legacy_packages_and_credentials(
18421885
"metadata": {
18431886
"python-versions": "*",
18441887
"content-hash": "123456789",
1845-
"hashes": {"foo": ["12345"], "bar": ["67890"]},
1888+
"files": {
1889+
"foo": [{"name": "foo.whl", "hash": "12345"}],
1890+
"bar": [{"name": "bar.whl", "hash": "67890"}],
1891+
},
18461892
},
18471893
}
18481894
)
@@ -1896,7 +1942,7 @@ def test_exporter_exports_requirements_txt_to_standard_output(
18961942
"metadata": {
18971943
"python-versions": "*",
18981944
"content-hash": "123456789",
1899-
"hashes": {"foo": [], "bar": []},
1945+
"files": {"foo": [], "bar": []},
19001946
},
19011947
}
19021948
)
@@ -1993,7 +2039,7 @@ def test_exporter_doesnt_confuse_repeated_packages(
19932039
"content-hash": (
19942040
"832b13a88e5020c27cbcd95faa577bf0dbf054a65c023b45dc9442b640d414e6"
19952041
),
1996-
"hashes": {
2042+
"files": {
19972043
"celery": [],
19982044
"click-didyoumean": [],
19992045
"click-plugins": [],
@@ -2112,7 +2158,7 @@ def test_exporter_handles_extras_next_to_non_extras(
21122158
"content-hash": (
21132159
"832b13a88e5020c27cbcd95faa577bf0dbf054a65c023b45dc9442b640d414e6"
21142160
),
2115-
"hashes": {
2161+
"files": {
21162162
"localstack": [],
21172163
"localstack-ext": [],
21182164
"something": [],
@@ -2202,7 +2248,7 @@ def test_exporter_handles_overlapping_python_versions(
22022248
"content-hash": (
22032249
"832b13a88e5020c27cbcd95faa577bf0dbf054a65c023b45dc9442b640d414e6"
22042250
),
2205-
"hashes": {
2251+
"files": {
22062252
"ipython": [],
22072253
"slash": [],
22082254
},
@@ -2292,7 +2338,7 @@ def test_exporter_omits_unwanted_extras(
22922338
"content-hash": (
22932339
"832b13a88e5020c27cbcd95faa577bf0dbf054a65c023b45dc9442b640d414e6"
22942340
),
2295-
"hashes": {
2341+
"files": {
22962342
"foo": [],
22972343
"pytest": [],
22982344
},
@@ -2360,7 +2406,7 @@ def test_exporter_respects_package_sources(tmp_dir: str, poetry: Poetry) -> None
23602406
"content-hash": (
23612407
"832b13a88e5020c27cbcd95faa577bf0dbf054a65c023b45dc9442b640d414e6"
23622408
),
2363-
"hashes": {
2409+
"files": {
23642410
"foo": [],
23652411
},
23662412
},
@@ -2432,7 +2478,7 @@ def test_exporter_tolerates_non_existent_extra(tmp_dir: str, poetry: Poetry) ->
24322478
"metadata": {
24332479
"python-versions": "*",
24342480
"content-hash": "123456789",
2435-
"hashes": {"foo": [], "bar": []},
2481+
"files": {"foo": [], "bar": []},
24362482
},
24372483
}
24382484
)

0 commit comments

Comments
 (0)