Add a test that test/cpython/v3_13/*.diff files stay in sync with the adapted test files
#189,607 opened on 2026/07/11
Repository metrics
- Stars
- (102,472 個のスター)
- PR merge metrics
- (平均マージ 1d 10h) (30d で 42 merged PRs)
説明
Context
test/cpython/v3_13/ vendors CPython test files adapted for the Dynamo test harness. Each test_*.py ships with a matching test_*.diff recording the delta from the pristine upstream file at a tagged CPython release (tag in the file's Dynamo patch header, e.g. v3.13.5). Currently 47 .py/.diff pairs.
These .diff files are generated and updated manually. Nothing verifies they still match reality. If someone edits a test_*.py without regenerating its .diff (or vice versa), the two silently drift apart and the .diff stops being a trustworthy record of what we changed from upstream.
Raised by @hameerabbasi in review of #189457.
Proposal
Add a test that, for each pair, verifies the .diff is in sync with the adapted file: regenerate the .diff from the pristine upstream file (at the tag named in the file header) and assert it matches the checked-in one, equivalently apply(pristine, recorded.diff) == in_tree.py.
Open questions
- Source of the pristine file. Regeneration needs the upstream file at the tag, fetched from GitHub. CI test shards generally can't rely on network. Options: (a) vendor pristine copies alongside the adapted ones, (b) make it a manually-run lint, or (c) run only in a job with network access.
- Diff noise.
git diffoutput carries blob hashes and hunk context; compare stably across environments (regenerate with fixed flags rather than byte-compare). - Tag consistency.
CHANGES.txtsays branchv3.13.0but per-file headers use thev3.13.5tag; read the tag from each file's header, not a hardcoded constant.
cc @mruberry @chauhang @penguinwu @voznesenskym @EikanWang @jgong5 @Guobing-Chen @XiaobingSuper @zhuhaozhe @blzheng @wenzhe-nrv @jiayisunx @kadeng @amjames @jataylo @azahed98