Bug 142012 - W3C importer should use filesystem instead of shutil/host
Summary: W3C importer should use filesystem instead of shutil/host
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: youenn fablet
URL:
Keywords:
Depends on:
Blocks: 142085
  Show dependency treegraph
 
Reported: 2015-02-25 01:23 PST by youenn fablet
Modified: 2015-02-28 14:48 PST (History)
3 users (show)

See Also:


Attachments
Patch (9.71 KB, patch)
2015-02-25 01:27 PST, youenn fablet
no flags Details | Formatted Diff | Diff
Patch for landing (9.39 KB, patch)
2015-02-28 13:52 PST, youenn fablet
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description youenn fablet 2015-02-25 01:23:32 PST
Tools/Scripts/w3c/test_importer.py should use Host abstraction in lieu of shutil, os...
Comment 1 youenn fablet 2015-02-25 01:27:28 PST
Created attachment 247322 [details]
Patch
Comment 2 Bem Jones-Bey 2015-02-25 10:08:11 PST
Comment on attachment 247322 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=247322&action=review

Does this enable the creation of any new unit tests, or do we have to wait until os.walk is replaced with something mockable?

> Tools/Scripts/webkitpy/w3c/test_importer.py:94
> +    if not FileSystem().exists(import_dir):

Nit: put FileSystem() in a local variable and use that here.
Comment 3 youenn fablet 2015-02-25 12:23:26 PST
(In reply to comment #2)
> Comment on attachment 247322 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=247322&action=review
> 
> Does this enable the creation of any new unit tests, or do we have to wait
> until os.walk is replaced with something mockable?

Good point.
We could already test quite some functionality by creating dedicated TestImporter.import_list and running TestImporter.import_tests.
But these tests may need to be updated whenever we change import_list/import_tests.
I would tend to wait until replacing os.walk to create black-box tests.

> > Tools/Scripts/webkitpy/w3c/test_importer.py:94
> > +    if not FileSystem().exists(import_dir):
> 
> Nit: put FileSystem() in a local variable and use that here.

OK
Comment 4 youenn fablet 2015-02-27 07:48:48 PST
(In reply to comment #3)
> (In reply to comment #2)
> > Comment on attachment 247322 [details]
> > Patch
> > 
> > View in context:
> > https://bugs.webkit.org/attachment.cgi?id=247322&action=review
> > 
> > Does this enable the creation of any new unit tests, or do we have to wait
> > until os.walk is replaced with something mockable?
> 
> Good point.
> We could already test quite some functionality by creating dedicated
> TestImporter.import_list and running TestImporter.import_tests.
> But these tests may need to be updated whenever we change
> import_list/import_tests.
> I would tend to wait until replacing os.walk to create black-box tests.

With patches from bug 142084 and bug 142085, test importer becomes testable with the mock system. Patch in bug 142085 adds one such unit test to ensure that.
Comment 5 Bem Jones-Bey 2015-02-27 17:25:49 PST
Comment on attachment 247322 [details]
Patch

Good stuff. r=me.
Comment 6 youenn fablet 2015-02-28 13:52:35 PST
Created attachment 247612 [details]
Patch for landing
Comment 7 WebKit Commit Bot 2015-02-28 14:48:01 PST
Comment on attachment 247612 [details]
Patch for landing

Clearing flags on attachment: 247612

Committed r180844: <http://trac.webkit.org/changeset/180844>
Comment 8 WebKit Commit Bot 2015-02-28 14:48:05 PST
All reviewed patches have been landed.  Closing bug.