Bug 214475 - [webkitcorepy] Add mocks.Time
Summary: [webkitcorepy] Add mocks.Time
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Tools / Tests (show other bugs)
Version: Safari 13
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Jonathan Bedard
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2020-07-17 07:34 PDT by Jonathan Bedard
Modified: 2020-08-07 12:24 PDT (History)
5 users (show)

See Also:


Attachments
Patch (12.07 KB, patch)
2020-07-17 07:44 PDT, Jonathan Bedard
no flags Details | Formatted Diff | Diff
Patch (12.62 KB, patch)
2020-07-22 12:17 PDT, Jonathan Bedard
no flags Details | Formatted Diff | Diff
Patch (12.53 KB, patch)
2020-07-30 09:17 PDT, Jonathan Bedard
no flags Details | Formatted Diff | Diff
Patch (12.55 KB, patch)
2020-07-30 21:18 PDT, Jonathan Bedard
no flags Details | Formatted Diff | Diff
Patch (12.54 KB, patch)
2020-08-04 12:56 PDT, Jonathan Bedard
no flags Details | Formatted Diff | Diff
Patch (9.68 KB, patch)
2020-08-04 22:23 PDT, Jonathan Bedard
no flags Details | Formatted Diff | Diff
Patch (9.68 KB, patch)
2020-08-07 08:15 PDT, Jonathan Bedard
no flags Details | Formatted Diff | Diff
Patch for landing (9.69 KB, patch)
2020-08-07 11:56 PDT, Jonathan Bedard
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jonathan Bedard 2020-07-17 07:34:39 PDT
Add a class which allows timeouts and time.sleep to function during unit testing without actually waiting.
Comment 1 Jonathan Bedard 2020-07-17 07:44:35 PDT
Created attachment 404560 [details]
Patch
Comment 2 Jonathan Bedard 2020-07-22 12:17:28 PDT
Created attachment 404946 [details]
Patch
Comment 3 Radar WebKit Bug Importer 2020-07-24 07:35:17 PDT
<rdar://problem/66052539>
Comment 4 Jonathan Bedard 2020-07-30 09:17:45 PDT
Created attachment 405578 [details]
Patch
Comment 5 Jonathan Bedard 2020-07-30 21:18:31 PDT
Created attachment 405663 [details]
Patch
Comment 6 Jonathan Bedard 2020-08-04 12:56:48 PDT
Created attachment 405937 [details]
Patch
Comment 7 Jonathan Bedard 2020-08-04 22:23:14 PDT
Created attachment 405986 [details]
Patch
Comment 8 Jonathan Bedard 2020-08-07 08:15:53 PDT
Created attachment 406176 [details]
Patch
Comment 9 dewei_zhu 2020-08-07 11:12:37 PDT
Comment on attachment 406176 [details]
Patch

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

> Tools/Scripts/libraries/webkitcorepy/webkitcorepy/mocks/time_.py:53
> +        self.patches.append([

Interesting, I thought patches is a list of patch, but it's actually a list of patch list. Correct?
Comment 10 Jonathan Bedard 2020-08-07 11:24:12 PDT
Comment on attachment 406176 [details]
Patch

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

>> Tools/Scripts/libraries/webkitcorepy/webkitcorepy/mocks/time_.py:53
>> +        self.patches.append([
> 
> Interesting, I thought patches is a list of patch, but it's actually a list of patch list. Correct?

Yes! That lets us stack this context, so something like this:

with mocks.Time:
    with mocks.Time:
         pass

Not something generally want to do, but a caller may not know what it's callees are doing.
Comment 11 Jonathan Bedard 2020-08-07 11:56:23 PDT
Created attachment 406196 [details]
Patch for landing
Comment 12 EWS 2020-08-07 12:24:31 PDT
Committed r265386: <https://trac.webkit.org/changeset/265386>

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