Refactor gpu_tests unit tests by using mock.patch
Instead of setting class member functions to MagicMock classes and making sure that they are set back to their original values at the end of a test within a finally block, we can use a with block by using mock.patch.object to patch member functions of a class. Also updates the sanitization of the tags returned from GetPlatformTags. Since tags are case insensitive we can remove the lower function call. We can also replace the chain of replace calls with one re.sub call to change spaces and underscores to dashes. Bug: chromium:976505 Change-Id: Ic8b5da86ef711d5698916fef40da0ed439b8ce49 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1670024 Commit-Queue: Rakib Hasan <rmhasan@google.com> Reviewed-by:Kenneth Russell <kbr@chromium.org> Cr-Commit-Position: refs/heads/master@{#671508}
Showing
Please register or sign in to comment