Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 97f987bedded3529cdda458f3436a6958910af0f
      
https://github.com/WebKit/WebKit/commit/97f987bedded3529cdda458f3436a6958910af0f
  Author: David Kilzer <[email protected]>
  Date:   2026-04-14 (Tue, 14 Apr 2026)

  Changed paths:
    A 
Tools/Scripts/libraries/webkitscmpy/webkitscmpy/test/prepare_commit_msg_unittest.py

  Log Message:
  -----------
  prepare-commit-msg: add unit test for git hook's get_bugs_string() to prevent 
future regressions
<https://bugs.webkit.org/show_bug.cgi?id=312300>
<rdar://174765471>

Reviewed by Jonathan Bedard.

Add regression tests for `get_bugs_string()` function in
the `prepare-commit-msg` git hook, which references
`radar.Tracker.RES` to detect radar URLs in commit messages.

Commit 311151@main accidentally removed the `RES` attribute during a
refactor, breaking the hook with an `AttributeError`. Commit
311158@main restored it, but no test existed to prevent
recurrence.

The test renders the real `prepare-commit-msg` Jinja2 template using the
same variables as `InstallHooks.main()`, loads the result via
`importlib.util`, and exercises `get_bugs_string()` under three
scenarios: radar URL present, non-radar URL present, and no URL
set.  Use `mocks.Radar()` so `radarclient()` returns a truthy
value, ensuring the `has_radar` code path through
`radar.Tracker.RES` is actually exercised.

* 
Tools/Scripts/libraries/webkitscmpy/webkitscmpy/test/prepare_commit_msg_unittest.py:
 Add.
(TestGetBugsString):
(TestGetBugsString.setUp):
(TestGetBugsString._load_hook_module):
(TestGetBugsString.test_radar_url_detected):
(TestGetBugsString.test_non_radar_url_prompts_for_radar):
(TestGetBugsString.test_no_bug_url):

Canonical link: https://commits.webkit.org/311223@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications

Reply via email to