|
32 | 32 | """ |
33 | 33 |
|
34 | 34 | mark_hashes_different = pytest.mark.xfail( |
35 | | - sys.version_info < (3, 9) or sys.platform.startswith("win32"), |
36 | | - reason="hashes differ on Windows and Python < 3.9", |
| 35 | + sys.platform.startswith("win32"), |
| 36 | + reason="hashes differ on Windows", |
37 | 37 | ) |
38 | 38 |
|
39 | 39 |
|
@@ -75,7 +75,14 @@ def test_pep517_sdist_hash(tmp_path, monkeypatch): |
75 | 75 | out = build_sdist(str(dist)) |
76 | 76 | sdist = dist / out |
77 | 77 | hash = hashlib.sha256(sdist.read_bytes()).hexdigest() |
78 | | - assert hash == "03455cc6996c1d0d4977bedb611180cf561ade9d70d7b5d1216a40405adf7b47" |
| 78 | + if sys.version_info < (3, 9): |
| 79 | + assert ( |
| 80 | + hash == "09b0593a80d0b0c086fddb99378e6dc75ba50e041076cd4a9a7afe4053407362" |
| 81 | + ) |
| 82 | + else: |
| 83 | + assert ( |
| 84 | + hash == "03455cc6996c1d0d4977bedb611180cf561ade9d70d7b5d1216a40405adf7b47" |
| 85 | + ) |
79 | 86 |
|
80 | 87 |
|
81 | 88 | def test_pep517_sdist_time_hash(tmp_path, monkeypatch): |
@@ -136,7 +143,14 @@ def test_pep517_sdist_time_hash_set_epoch(tmp_path, monkeypatch): |
136 | 143 | out = build_sdist(str(dist), {"scikit-build-core.sdist.reproducible": "false"}) |
137 | 144 | sdist = dist / out |
138 | 145 | hash = hashlib.sha256(sdist.read_bytes()).hexdigest() |
139 | | - assert hash == "a39a0eecb02f7b583ab3008c0c64c55eaef9d0bb5e712b6cb8d469598771ddfb" |
| 146 | + if sys.version_info < (3, 9): |
| 147 | + assert ( |
| 148 | + hash == "7656ce7df4c1d6bbd098f046f75bb610104260542de5eeaf40993bb2976bf34e" |
| 149 | + ) |
| 150 | + else: |
| 151 | + assert ( |
| 152 | + hash == "a39a0eecb02f7b583ab3008c0c64c55eaef9d0bb5e712b6cb8d469598771ddfb" |
| 153 | + ) |
140 | 154 |
|
141 | 155 |
|
142 | 156 | @pytest.mark.compile |
@@ -189,3 +203,31 @@ def test_pep517_wheel(tmp_path, monkeypatch, virtualenv): |
189 | 203 | capture=True, |
190 | 204 | ) |
191 | 205 | assert add.strip() == "3" |
| 206 | + |
| 207 | + |
| 208 | +@pytest.mark.skip(reason="Doesn't work yet") |
| 209 | +@pytest.mark.compile |
| 210 | +@pytest.mark.configure |
| 211 | +def test_pep517_wheel_time_hash(tmp_path, monkeypatch): |
| 212 | + dist = tmp_path / "dist" |
| 213 | + dist.mkdir() |
| 214 | + monkeypatch.chdir(HELLO_PEP518) |
| 215 | + monkeypatch.setenv("SOURCE_DATE_EPOCH", "12345") |
| 216 | + if Path("dist").is_dir(): |
| 217 | + shutil.rmtree("dist") |
| 218 | + out = build_wheel(str(dist)) |
| 219 | + wheel = dist / out |
| 220 | + hash1 = hashlib.sha256(wheel.read_bytes()).hexdigest() |
| 221 | + |
| 222 | + time.sleep(2) |
| 223 | + Path("src/main.cpp").touch() |
| 224 | + |
| 225 | + if Path("dist").is_dir(): |
| 226 | + shutil.rmtree("dist") |
| 227 | + |
| 228 | + out = build_wheel(str(dist)) |
| 229 | + wheel = dist / out |
| 230 | + |
| 231 | + hash2 = hashlib.sha256(wheel.read_bytes()).hexdigest() |
| 232 | + |
| 233 | + assert hash1 == hash2 |
0 commit comments