3
3
import importlib
4
4
import os
5
5
import platform
6
- import subprocess
7
6
import sys
8
7
import zipfile
9
8
from argparse import Namespace
@@ -138,29 +137,25 @@ def test_analyze_wheel_abi_static_exe(caplog):
138
137
assert result .overall_policy .name == "manylinux_2_5_x86_64"
139
138
140
139
141
- @pytest .mark .skipif (platform .machine () != "x86_64" , reason = "only checked on x86_64" )
142
- def test_wheel_source_date_epoch (tmp_path , monkeypatch ):
143
- wheel_build_path = tmp_path / "wheel"
144
- subprocess .run (
145
- [
146
- sys .executable ,
147
- "-m" ,
148
- "pip" ,
149
- "wheel" ,
150
- "--no-deps" ,
151
- "-w" ,
152
- wheel_build_path ,
153
- HERE / "sample_extension" ,
154
- ],
155
- check = True ,
140
+ @pytest .mark .parametrize (
141
+ "timestamp" ,
142
+ [
143
+ (0 , 315532800 ), # zip timestamp starts 1980-01-01, not 1970-01-01
144
+ (315532799 , 315532800 ), # zip timestamp starts 1980-01-01, not 1970-01-01
145
+ (315532801 , 315532800 ), # zip timestamp round odd seconds down to even seconds
146
+ (315532802 , 315532802 ),
147
+ (650203201 , 650203200 ), # zip timestamp round odd seconds down to even seconds
148
+ ],
149
+ )
150
+ def test_wheel_source_date_epoch (timestamp , tmp_path , monkeypatch ):
151
+ wheel_path = (
152
+ HERE / "arch-wheels/musllinux_1_2/testsimple-0.0.1-cp312-cp312-linux_x86_64.whl"
156
153
)
157
-
158
- wheel_path , * _ = list (wheel_build_path .glob ("*.whl" ))
159
154
wheel_output_path = tmp_path / "out"
160
155
args = Namespace (
161
156
LIB_SDIR = ".libs" ,
162
157
ONLY_PLAT = False ,
163
- PLAT = "manylinux_2_5_x86_64 " ,
158
+ PLAT = "auto " ,
164
159
STRIP = False ,
165
160
UPDATE_TAGS = True ,
166
161
WHEEL_DIR = wheel_output_path ,
@@ -173,7 +168,8 @@ def test_wheel_source_date_epoch(tmp_path, monkeypatch):
173
168
prog = "auditwheel" ,
174
169
verbose = 1 ,
175
170
)
176
- monkeypatch .setenv ("SOURCE_DATE_EPOCH" , "650203200" )
171
+
172
+ monkeypatch .setenv ("SOURCE_DATE_EPOCH" , str (timestamp [0 ]))
177
173
# patchelf might not be available as we aren't running in a manylinux container
178
174
# here. We don't need need it in this test, so just patch it.
179
175
with mock .patch ("auditwheel.patcher._verify_patchelf" ):
@@ -182,6 +178,5 @@ def test_wheel_source_date_epoch(tmp_path, monkeypatch):
182
178
output_wheel , * _ = list (wheel_output_path .glob ("*.whl" ))
183
179
with zipfile .ZipFile (output_wheel ) as wheel_file :
184
180
for file in wheel_file .infolist ():
185
- assert (
186
- datetime (* file .date_time , tzinfo = timezone .utc ).timestamp () == 650203200
187
- )
181
+ file_date_time = datetime (* file .date_time , tzinfo = timezone .utc )
182
+ assert file_date_time .timestamp () == timestamp [1 ]
0 commit comments