Skip to content

Commit add013c

Browse files
committed
Add expat version verification test for windows
1 parent 640a5bc commit add013c

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

tests/test_verify_build.py

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2096,3 +2096,42 @@ def test_install_setuptools_25_2_to_25_3(pipexec, build, minor_version, pip_vers
20962096
],
20972097
check=True,
20982098
)
2099+
2100+
2101+
@pytest.mark.skip_unless_on_windows
2102+
def test_expat_version_windows(pyexec):
2103+
"""
2104+
Verify that the Windows build contains the correct expat version.
2105+
2106+
This validates that update_expat() in windows.py successfully updated
2107+
the bundled expat library to match the version in python-versions.json.
2108+
"""
2109+
from relenv.build.common import get_dependency_version
2110+
2111+
# Get expected version from python-versions.json
2112+
expat_info = get_dependency_version("expat", "win32")
2113+
if not expat_info:
2114+
pytest.skip("No expat version defined in python-versions.json for win32")
2115+
2116+
expected_version = expat_info["version"]
2117+
2118+
# Get actual version from the build
2119+
proc = subprocess.run(
2120+
[str(pyexec), "-c", "import pyexpat; print(pyexpat.EXPAT_VERSION)"],
2121+
capture_output=True,
2122+
check=True,
2123+
)
2124+
2125+
actual_version_str = proc.stdout.decode().strip()
2126+
# Format is "expat_X_Y_Z", extract version
2127+
assert actual_version_str.startswith(
2128+
"expat_"
2129+
), f"Unexpected EXPAT_VERSION format: {actual_version_str}"
2130+
2131+
# Convert "expat_2_7_3" -> "2.7.3"
2132+
actual_version = actual_version_str.replace("expat_", "").replace("_", ".")
2133+
2134+
assert actual_version == expected_version, (
2135+
f"Expat version mismatch: expected {expected_version}, "
2136+
f"found {actual_version} (from {actual_version_str})"
2137+
)

0 commit comments

Comments
 (0)