Bug 235370 - Move tests to pyfakefs from FileSystemMock
Summary: Move tests to pyfakefs from FileSystemMock
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Tools / Tests (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Sam Sneddon [:gsnedders]
URL:
Keywords: InRadar
Depends on:
Blocks: 220421
  Show dependency treegraph
 
Reported: 2022-01-19 11:18 PST by Sam Sneddon [:gsnedders]
Modified: 2022-02-02 15:39 PST (History)
5 users (show)

See Also:


Attachments
Patch (10.49 KB, patch)
2022-01-28 13:19 PST, Sam Sneddon [:gsnedders]
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Sam Sneddon [:gsnedders] 2022-01-19 11:18:54 PST
see https://github.com/jmcgeheeiv/pyfakefs

This has a bunch of advantages over our current FileSystemMock:

Avoids us having to maintain our own re-implementation (which currently has a variety of issues)

Can configure it to emulate Windows/Linux/macOS behaviour on other systems, allowing us to test things still work on Windows more easily

Provides a path away from our current FileSystem class towards using the standard library functions directly
Comment 1 Radar WebKit Bug Importer 2022-01-19 12:24:04 PST
<rdar://problem/87785236>
Comment 2 Sam Sneddon [:gsnedders] 2022-01-28 13:19:04 PST
Created attachment 450272 [details]
Patch
Comment 3 Jonathan Bedard 2022-02-01 08:04:29 PST
Comment on attachment 450272 [details]
Patch

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

> Tools/Scripts/webkitpy/layout_tests/controllers/layout_test_finder_legacy_unittest.py:57
> +        self.setUpPyfakefs()

I agree that using pyfakefs through the TestCaseMixin is the right thing to do for this class. I'm curious if you looked at the Patcher and considered it at all? Or was the Mixin just the natural choice because this particular set of tests was already using setup.
Comment 4 Sam Sneddon [:gsnedders] 2022-02-01 08:32:02 PST
Comment on attachment 450272 [details]
Patch

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

>> Tools/Scripts/webkitpy/layout_tests/controllers/layout_test_finder_legacy_unittest.py:57
>> +        self.setUpPyfakefs()
> 
> I agree that using pyfakefs through the TestCaseMixin is the right thing to do for this class. I'm curious if you looked at the Patcher and considered it at all? Or was the Mixin just the natural choice because this particular set of tests was already using setup.

Using Patcher requires reimplementing a lot of the TestCaseMixin machinery for very little gain.
Comment 5 EWS 2022-02-01 08:36:48 PST
Committed r288878 (246630@main): <https://commits.webkit.org/246630@main>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 450272 [details].