Skip to content

Commit e6778e5

Browse files
committed
Add tests to verify our version updates are working
1 parent e11a111 commit e6778e5

File tree

4 files changed

+21
-15
lines changed

4 files changed

+21
-15
lines changed

relenv/build/darwin.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,9 @@
88

99
import glob
1010
import io
11-
import os
1211
import pathlib
1312
import shutil
1413
import tarfile
15-
import time
1614
import urllib.request
1715
from typing import IO, MutableMapping
1816

@@ -24,7 +22,6 @@
2422
builds,
2523
finalize,
2624
get_dependency_version,
27-
update_sbom_checksums,
2825
)
2926

3027
ARCHES = arches[DARWIN]
@@ -98,11 +95,16 @@ def update_expat(dirs: Dirs, env: MutableMapping[str, str]) -> None:
9895

9996
# Touch all updated files to ensure make rebuilds them
10097
# (The tarball may contain files with newer timestamps)
98+
import time
99+
import os
100+
101101
now = time.time()
102102
for target_file in updated_files:
103103
os.utime(target_file, (now, now))
104104

105105
# Update SBOM with correct checksums for updated expat files
106+
from relenv.build.common import update_sbom_checksums
107+
106108
files_to_update = {}
107109
for target_file in updated_files:
108110
# SBOM uses relative paths from Python source root

relenv/build/linux.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
import shutil
1414
import tarfile
1515
import tempfile
16-
import time
1716
import urllib.request
1817
from typing import IO, MutableMapping
1918

@@ -25,7 +24,6 @@
2524
builds,
2625
finalize,
2726
get_dependency_version,
28-
update_sbom_checksums,
2927
)
3028
from ..common import LINUX, Version, arches, runcmd
3129

@@ -410,11 +408,15 @@ def update_expat(dirs: Dirs, env: EnvMapping) -> None:
410408

411409
# Touch all updated files to ensure make rebuilds them
412410
# (The tarball may contain files with newer timestamps)
411+
import time
412+
413413
now = time.time()
414414
for target_file in updated_files:
415415
os.utime(target_file, (now, now))
416416

417417
# Update SBOM with correct checksums for updated expat files
418+
from relenv.build.common import update_sbom_checksums
419+
418420
files_to_update = {}
419421
for target_file in updated_files:
420422
# SBOM uses relative paths from Python source root

relenv/build/windows.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
import shutil
1515
import sys
1616
import tarfile
17-
import time
1817
from typing import IO, MutableMapping, Union
1918

2019
from .common import (
@@ -25,7 +24,6 @@
2524
install_runtime,
2625
patch_file,
2726
update_ensurepip,
28-
update_sbom_checksums,
2927
)
3028
from ..common import (
3129
WIN32,
@@ -261,11 +259,17 @@ def update_expat(dirs: Dirs, env: EnvMapping) -> None:
261259

262260
# Touch all updated files to ensure MSBuild rebuilds them
263261
# (The original files may have newer timestamps)
262+
import time
263+
264264
now = time.time()
265265
for target_file in updated_files:
266266
os.utime(target_file, (now, now))
267267

268268
# Map SBOM file names to actual file paths
269+
# Update SBOM with correct checksums for updated expat files
270+
# Map SBOM file names to actual file paths
271+
from relenv.build.common import update_sbom_checksums
272+
269273
files_to_update = {}
270274
for target_file in updated_files:
271275
# SBOM uses relative paths from Python source root

tests/test_verify_build.py

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2142,10 +2142,9 @@ def test_expat_version(pyexec):
21422142
# Convert "expat_2_7_3" -> "2.7.3"
21432143
actual_version = actual_version_str.replace("expat_", "").replace("_", ".")
21442144

2145-
assert actual_version == expected_version, (
2146-
f"Expat version mismatch on {platform}: expected {expected_version}, "
2147-
f"found {actual_version} (from {actual_version_str})"
2148-
)
2145+
assert (
2146+
actual_version == expected_version
2147+
), f"Expat version mismatch on {platform}: expected {expected_version}, "
21492148

21502149

21512150
def test_sqlite_version(pyexec):
@@ -2245,10 +2244,9 @@ def test_openssl_version(pyexec):
22452244

22462245
actual_version = match.group(1)
22472246

2248-
assert actual_version == expected_version, (
2249-
f"OpenSSL version mismatch on {platform}: expected {expected_version}, "
2250-
f"found {actual_version} (from {actual_version_str})"
2251-
)
2247+
assert (
2248+
actual_version == expected_version
2249+
), f"found {actual_version} (from {actual_version_str})"
22522250

22532251

22542252
def test_xz_lzma_functionality(pyexec):

0 commit comments

Comments
 (0)