Bug 312300
| Summary: | prepare-commit-msg: add unit test for git hook's get_bugs_string() to prevent future regressions | ||
|---|---|---|---|
| Product: | WebKit | Reporter: | David Kilzer (:ddkilzer) <ddkilzer> |
| Component: | Tools / Tests | Assignee: | Jonathan Bedard <jbedard> |
| Status: | RESOLVED FIXED | ||
| Severity: | Normal | CC: | webkit-bug-importer |
| Priority: | P2 | Keywords: | InRadar |
| Version: | WebKit Nightly Build | ||
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
| Bug Depends on: | 309535 | ||
| Bug Blocks: | |||
David Kilzer (:ddkilzer)
The `get_bugs_string()` function in the `prepare-commit-msg` git hook directly references `radar.Tracker.RES` to detect radar URLs in commit messages. When 311151@main refactored `from_string()` to use `parse_id()`, it removed the `RES` attribute from `radar.Tracker`, breaking the hook with an `AttributeError`. This was fixed by 311158@main, but there is no unit test to prevent the regression from recurring.
Add a unit test that renders the real `prepare-commit-msg` hook template via `jinja2.Template` (same as `InstallHooks.main()`), loads the rendered script via `importlib.util`, and tests `get_bugs_string()` to verify `radar.Tracker.RES` is present and correctly matches radar URL formats.
| Attachments | ||
|---|---|---|
| Add attachment proposed patch, testcase, etc. |
Radar WebKit Bug Importer
<rdar://problem/174765471>
David Kilzer (:ddkilzer)
Pull request: https://github.com/WebKit/WebKit/pull/62760
EWS
Committed 311223@main (97f987bedded): <https://commits.webkit.org/311223@main>
Reviewed commits have been landed. Closing PR #62760 and removing active labels.
Jonathan Bedard
Re-opening for pull request https://github.com/WebKit/WebKit/pull/62837
EWS
Committed 311315@main (2625dd9448f9): <https://commits.webkit.org/311315@main>
Reviewed commits have been landed. Closing PR #62837 and removing active labels.