From 864fa61bf8171a2fa96ea9db247d79be96176a4d Mon Sep 17 00:00:00 2001 From: BearHuddleston Date: Mon, 23 Nov 2026 08:23:46 +0000 Subject: [PATCH] test(release): run the publication tests through the gh that PATH resolves The release_body fixture made shutil.which miss, so render-builds-table.py fell back to bare "gh" and the tests passed even with the PATH/PATHEXT lookup removed. No test covered that fix after test_tag_builds_summary.py was deleted on main. The fixture now resolves gh to a fake path, and the fake accepts only that path for both the view and the edit. A mutant that goes back to bare "gh" fails 9 of 18 tests, and so does one where only the edit uses bare "gh". The old fixture passed 18/18 on both. Found by the sol-loop review on #159146. --- tests/scripts/test_render_builds_publication.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/tests/scripts/test_render_builds_publication.py b/tests/scripts/test_render_builds_publication.py index 5628bff592..39157e02b7 100644 --- a/tests/scripts/test_render_builds_publication.py +++ b/tests/scripts/test_render_builds_publication.py @@ -25,17 +25,19 @@ _SPEC.loader.exec_module(rbt) def release_body(monkeypatch): state = {'body': '# Notes\n\n\n\n## Changes\n- x\n', 'edits': []} + # gh as PATH and PATHEXT resolve it (gh.cmd on Windows); both calls must run that path. + resolved = '/fake/bin/gh.cmd' + def gh(argv, **kwargs): - if argv[:3] == ['gh', 'release', 'view']: + if argv[:3] == [resolved, 'release', 'view']: return subprocess.CompletedProcess(argv, 0, json.dumps({'body': state['body']}), '') - assert argv[:3] == ['gh', 'release', 'edit'] + assert argv[:3] == [resolved, 'release', 'edit'] state['body'] = kwargs['input'] state['edits'].append(state['body']) return subprocess.CompletedProcess(argv, 0, '', '') monkeypatch.setattr(rbt.subprocess, 'run', gh) - # The fake above is the gh; never resolve a host's real one. - monkeypatch.setattr(rbt.shutil, 'which', lambda _name: None) + monkeypatch.setattr(rbt.shutil, 'which', lambda name: resolved if name == 'gh' else None) return state