Files
yiyezhqiu-refactored/tests/packaging/test_release_definition.py
T

70 lines
2.2 KiB
Python

from pathlib import Path
def test_spec_builds_onedir_with_private_runtime() -> None:
text = Path("packaging/DxDesignerTools.spec").read_text(encoding="utf-8")
assert "COLLECT(" in text
assert 'contents_directory="_runtime"' in text
assert 'name="DxDesignerTools"' in text
assert "console=False" in text
def test_build_script_assembles_portable_root_without_installing_packages() -> None:
text = Path("packaging/build_release.ps1").read_text(encoding="utf-8")
for name in (
"MenuAdd.vbs",
"DesignBridge.vbs",
"CompatibilityProbe.vbs",
"BridgeCommon.vbs",
"Snapshot.vbs",
"Transaction.vbs",
"Mailbox.vbs",
"BomExport.vbs",
"ExpeditionBridge.vbs",
"BOM模板.xls",
"DxDesignerTools.exe",
"DxDesigner效率工具_Win11_x64.zip",
"SHA256SUMS.txt",
):
assert name in text
assert "_runtime\\vbs" in text
assert "Compress-Archive" in text
assert "pip install" not in text.casefold()
assert "Invoke-WebRequest" not in text
def test_build_script_has_utf8_bom_for_windows_powershell_51() -> None:
data = Path("packaging/build_release.ps1").read_bytes()
assert data.startswith(b"\xef\xbb\xbf")
def test_build_dependencies_pin_pyinstaller_major_version() -> None:
text = Path("pyproject.toml").read_text(encoding="utf-8")
assert 'pyinstaller>=6.11,<7' in text
def test_build_script_no_longer_ships_legacy_compat_assets() -> None:
"""The legacy EFM/VBS compat layer is retired; only the BOM template and
the Expedition adapter ship with a release."""
text = Path("packaging/build_release.ps1").read_text(encoding="utf-8")
assert "legacy\\yiyezhqiu" not in text
assert "modules\\legacy" not in text
assert "LegacyMenu.vbs" not in text
assert "RefDesBridge.vbs" not in text
assert "D:\\NET_CHECK" not in text
assert "version.json" in text
assert "update-manifest.template.json" in text
def test_signing_tool_exists_and_is_documented() -> None:
text = Path("packaging/sign_manifest.py").read_text(encoding="utf-8")
assert "Ed25519PrivateKey" in text
assert "--package" in text
assert "--key" in text