Closed Bug 1054517 Opened 11 years ago Closed 11 years ago

Port Mercurial commit message hook tests to .t test

Categories

(Developer Services :: Mercurial: hg.mozilla.org, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: gps, Assigned: gps, Mentored)

References

Details

Attachments

(5 files)

We are in the process of converting Mercurial tests in https://hg.mozilla.org/hgcustom/version-control-tools/ to the Mercurial .t test format. Details of that format at http://mercurial.selenic.com/wiki/WritingTests#Writing_a_shell_script_test. In this mentored bug, you will take the tests for the commit message hook (https://hg.mozilla.org/hgcustom/version-control-tools/file/6f1da8433d97/hghooks/runtests.py#l402) and port them to a .t test. You can find existing hooks .t tests in https://hg.mozilla.org/hgcustom/version-control-tools/file/6f1da8433d97/hghooks/tests. An example conversion is https://hg.mozilla.org/hgcustom/version-control-tools/rev/42b4b8f97dfa.
I finished this on a plane over the weekend. Patches forthcoming.
Assignee: nobody → gps
Status: NEW → ASSIGNED
Attachment #8478340 - Flags: review?(emorley)
During the port, it was realized that the testing methodology in runtests.py was flawed. Since commits were being stacked, the old testing code only verified that any commit was bad, not necessarily that the top commit was bad. This revealed that the hook was examining the full commit message for bug and backout syntax, as opposed to only the first line. The hook has been updated to make the tests pass.
Attachment #8478342 - Flags: review?(emorley)
Porting to a .t test required a custom Mercurial extension that intercepts urllib requests. It has been implemented as part of this patch. It isn't fully functional, but it mimics the old testing code and it gets the job done.
Attachment #8478344 - Flags: review?(emorley)
Reviewer note: you may want to look at the previous treeclosure patch to validate some of the approach.
Attachment #8478345 - Flags: review?(bugspam.Callek)
All tests in hghooks have been converted to .t tests. We can now remove hghooks/runtests.py and its integration with run-mercurial-tests.py.
Attachment #8478346 - Flags: review?(emorley)
Comment on attachment 8478345 [details] [diff] [review] Port treeclosure-comm-central tests to .t format I'm not sure if I can get to this within the next week or 2, but if ed wants to review this in my stead, I am happy to accept his review.
Attachment #8478345 - Flags: review?(emorley)
Attachment #8478340 - Flags: review?(emorley) → review+
Comment on attachment 8478342 [details] [diff] [review] Port commit-messages hook tests to .t tests Review of attachment 8478342 [details] [diff] [review]: ----------------------------------------------------------------- Thank you - this fixes bug 1053177 for me :-)
Attachment #8478342 - Flags: review?(emorley) → review+
Attachment #8478344 - Flags: review?(emorley) → review+
Attachment #8478345 - Flags: review?(emorley) → review+
Comment on attachment 8478346 [details] [diff] [review] Remove empty hghooks test harness Review of attachment 8478346 [details] [diff] [review]: ----------------------------------------------------------------- ::: run-mercurial-tests.py @@ -161,5 @@ > - > - # TODO hook up to unittest directly and share TestSuite and TestResult > - # with Mercurial. > - args = [sys.executable, os.path.join(HERE, 'hghooks', 'runtests.py')] > - res2 = subprocess.call(args, cwd=os.path.join(HERE, 'hghooks'), env=env) This was the last use of subprocess, the import can be removed now.
Attachment #8478346 - Flags: review?(emorley) → review+
Comment on attachment 8478345 [details] [diff] [review] Port treeclosure-comm-central tests to .t format Callek deferred review to edmorley.
Attachment #8478345 - Flags: review?(bugspam.Callek)
I removed the subprocess import from run-mercurial-tests.py. Thanks for the speedy review! Good riddance to the old tests and the test spam from runtests.py.
Status: ASSIGNED → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Product: Release Engineering → Developer Services
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: