Files
dxdesigner-part-replacement/tests/packaging/test_release_configuration.py
T
阿白叔 cd9431985e
Core regression / Python core and release configuration (push) Failing after 1m52s
build: prepare complete V1.2.1 runtime and Gitea regression workflow
2026-11-02 14:55:52 +08:00

29 lines
1.4 KiB
Python

"""Catch missing runtime assets and mismatched version identity before release."""
import ast
from pathlib import Path
import tomllib
ROOT = Path(__file__).resolve().parents[2]
def test_release_version_matches_python_and_windows_resources():
namespace = {}
exec((ROOT / 'src/dx_productivity/trial_task_center/version.py').read_text(), namespace)
version = namespace['VERSION']
assert tomllib.loads((ROOT / 'pyproject.toml').read_text())['project']['version'] == version
info = (ROOT / 'packaging/windows-version-info.txt').read_text()
assert f"StringStruct('ProductVersion', '{version}')" in info
parts = tuple(int(n) for n in version.split('.')) + (0,)
assert f'filevers={parts}' in info and f'prodvers={parts}' in info
def test_release_spec_includes_all_assets_and_complete_runtime():
tree = ast.parse((ROOT / 'packaging/DxPartReplace.spec').read_text())
constants = {node.value for node in ast.walk(tree) if isinstance(node, ast.Constant) and isinstance(node.value, str)}
assert 'src/dx_productivity/trial_task_center/assets' in constants
assert not any(isinstance(node, ast.Call) and isinstance(node.func, ast.Name)
and node.func.id == 'stage_node_modules' for node in ast.walk(tree))
assert {'dsh-runtime/node_modules', 'dsh-runtime/task-plugin',
'issue-bootstrap.json', 'PySide6.QtWebEngineCore',
'PySide6.QtWebEngineWidgets'} <= constants