Skip to content

Commit b1d3604

Browse files
committed
test(build): order in RECORD files and archives should be deterministic due to #545
1 parent 7976f68 commit b1d3604

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

tests/masonry/builders/test_complete.py

+6-8
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,7 @@ def test_wheel_c_extension(project: str, exptected_c_dir: str) -> None:
9595
assert re.search(r"\s+extended/extended.*\.(so|pyd)", record) is not None
9696

9797
# Files in RECORD should match files in wheel.
98-
zip_files = sorted(zipf.namelist())
99-
assert zip_files == sorted(record_files)
98+
assert zipf.namelist() == record_files
10099
assert len(set(record_files)) == len(record_files)
101100

102101

@@ -125,17 +124,17 @@ def test_complete(no_vcs: bool) -> None:
125124
"my_package/sub_pkg1/__init__.py",
126125
"my_package/sub_pkg2/__init__.py",
127126
"my_package/sub_pkg2/data2/data.json",
128-
"my_package-1.2.3.data/scripts/script.sh",
129127
"my_package/sub_pkg3/foo.py",
128+
"my_package-1.2.3.data/scripts/script.sh",
130129
"my_package-1.2.3.dist-info/entry_points.txt",
131130
"my_package-1.2.3.dist-info/LICENSE",
132-
"my_package-1.2.3.dist-info/WHEEL",
133131
"my_package-1.2.3.dist-info/METADATA",
132+
"my_package-1.2.3.dist-info/WHEEL",
134133
"my_package-1.2.3.dist-info/RECORD",
135134
]
136135

137136
with zipfile.ZipFile(str(whl)) as zipf:
138-
assert sorted(zipf.namelist()) == sorted(expected_name_list)
137+
assert zipf.namelist() == expected_name_list
139138
assert (
140139
"Hello World"
141140
in zipf.read("my_package-1.2.3.data/scripts/script.sh").decode()
@@ -208,12 +207,11 @@ def test_complete(no_vcs: bool) -> None:
208207
)
209208
actual_records = zipf.read("my_package-1.2.3.dist-info/RECORD").decode()
210209

211-
# For some reason, the ordering of the files and the SHA hashes
212-
# vary per operating systems and Python versions.
210+
# The SHA hashes vary per operating systems.
213211
# So instead of 1:1 assertion, let's do a bit clunkier one:
214212
actual_files = [row[0] for row in csv.reader(actual_records.splitlines())]
215213

216-
assert sorted(actual_files) == sorted(expected_name_list)
214+
assert actual_files == expected_name_list
217215

218216

219217
def test_module_src() -> None:

0 commit comments

Comments
 (0)