Port Mercurial commit message hook tests to .t test

RESOLVED FIXED

Status

Developer Services
Mercurial: hg.mozilla.org
RESOLVED FIXED
3 years ago
3 years ago

People

(Reporter: gps, Assigned: gps, Mentored)

Tracking

Details

Attachments

(5 attachments)

(Assignee)

Description

3 years ago
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.
(Assignee)

Comment 1

3 years ago
I finished this on a plane over the weekend. Patches forthcoming.
Assignee: nobody → gps
Status: NEW → ASSIGNED
(Assignee)

Comment 2

3 years ago
Created attachment 8478340 [details] [diff] [review]
Port case only rename hook tests to .t tests
Attachment #8478340 - Flags: review?(emorley)
(Assignee)

Comment 3

3 years ago
Created attachment 8478342 [details] [diff] [review]
Port commit-messages hook tests to .t tests

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)
(Assignee)

Comment 4

3 years ago
Created attachment 8478344 [details] [diff] [review]
Port treeclosure hook tests to .t test

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)
(Assignee)

Comment 5

3 years ago
Created attachment 8478345 [details] [diff] [review]
Port treeclosure-comm-central tests to .t format

Reviewer note: you may want to look at the previous treeclosure patch
to validate some of the approach.
Attachment #8478345 - Flags: review?(bugspam.Callek)
(Assignee)

Comment 6

3 years ago
Created attachment 8478346 [details] [diff] [review]
Remove empty hghooks test harness

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)

Updated

3 years ago
Attachment #8478340 - Flags: review?(emorley) → review+

Comment 8

3 years ago
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+

Updated

3 years ago
Attachment #8478344 - Flags: review?(emorley) → review+

Updated

3 years ago
Attachment #8478345 - Flags: review?(emorley) → review+

Comment 9

3 years ago
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+

Updated

3 years ago
Duplicate of this bug: 1053177
(Assignee)

Comment 11

3 years ago
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)
(Assignee)

Comment 12

3 years ago
https://hg.mozilla.org/hgcustom/version-control-tools/rev/84358290af8a
https://hg.mozilla.org/hgcustom/version-control-tools/rev/c25d0b056d19
https://hg.mozilla.org/hgcustom/version-control-tools/rev/2cff974474b7
https://hg.mozilla.org/hgcustom/version-control-tools/rev/7ca809dc0f15
https://hg.mozilla.org/hgcustom/version-control-tools/rev/6d6cc743a5af
(Assignee)

Comment 13

3 years ago
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
Last Resolved: 3 years ago
Resolution: --- → FIXED
Product: Release Engineering → Developer Services
(Assignee)

Updated

3 years ago
Duplicate of this bug: 1006264
You need to log in before you can comment on or make changes to this bug.