Bug 103900 - Many webkitpy unit tests can be run standalone, are executable
Summary: Many webkitpy unit tests can be run standalone, are executable
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Tools / Tests (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Zan Dobersek
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-12-03 08:57 PST by Zan Dobersek
Modified: 2012-12-04 12:35 PST (History)
6 users (show)

See Also:


Attachments
Patch (50.80 KB, patch)
2012-12-04 00:57 PST, Zan Dobersek
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Zan Dobersek 2012-12-03 08:57:50 PST
There are many unit tests in webkitpy containing the following two lines at the bottom:

if __name__=='__main__':
    unittest.main()

Some unit test files are even executable and/or containing the shebang line at the top of the file.

I guess there was once a tendency to be able to run only specific unit tests. Given that today the tests, when running test-webkitpy, are run in parallel and can be narrowed down via the command line, is there still a requirement for that?
Comment 1 Dirk Pranke 2012-12-03 10:16:08 PST
As you say, I originally ran many of the unit tests individually to test modules; partially this was because of python convention, and partially this was because test-webkitpy was pretty bare-bones and missing a bunch of stuff I needed (like being able to get coverage numbers). I've added all of the features to test-webkitpy since then, and rarely run the tests directly now, so there's no real reason to keep these lines.

(The other people who did python development, like eseidel and abarth, pretty much never used these lines in the first place, so I don't think anyone will object to removing them across the board).
Comment 2 Eric Seidel (no email) 2012-12-03 10:20:43 PST
Nope. :)  Go for it.
Comment 3 Zan Dobersek 2012-12-04 00:57:52 PST
Created attachment 177438 [details]
Patch
Comment 4 Zan Dobersek 2012-12-04 01:02:29 PST
(In reply to comment #3)
> Created an attachment (id=177438) [details]
> Patch

This patch only covers unit tests, but there are other files as well that contain shebang lines and are executable. I'll spin up another patch for those.
Comment 5 Eric Seidel (no email) 2012-12-04 01:07:00 PST
Comment on attachment 177438 [details]
Patch

LGTM.  But you probably want to wait for Dirk to confirm.
Comment 6 Dirk Pranke 2012-12-04 11:06:52 PST
Comment on attachment 177438 [details]
Patch

looks fine.
Comment 7 Zan Dobersek 2012-12-04 12:35:03 PST
Comment on attachment 177438 [details]
Patch

Clearing flags on attachment: 177438

Committed r136548: <http://trac.webkit.org/changeset/136548>
Comment 8 Zan Dobersek 2012-12-04 12:35:09 PST
All reviewed patches have been landed.  Closing bug.