Changeset 229921 in webkit
- Timestamp:
- Mar 23, 2018 2:19:37 PM (6 years ago)
- Location:
- trunk/Tools
- Files:
-
- 1 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Tools/ChangeLog
r229913 r229921 1 2018-03-23 Brendan McLoughlin <brendan@bocoup.com> 2 3 Lint web-platform-tests changes with the wpt linter before exporting 4 https://bugs.webkit.org/show_bug.cgi?id=183796 5 6 Reviewed by Youenn Fablet. 7 8 * Scripts/webkitpy/w3c/test_exporter.py: 9 (TestExporter.__init__): 10 (TestExporter.do_export): 11 * Scripts/webkitpy/w3c/test_exporter_unittest.py: 12 (TestExporterTest.MockWPTLinter): 13 (TestExporterTest.MockWPTLinter.__init__): 14 (TestExporterTest.MockWPTLinter.lint): 15 (TestExporterTest.test_export): 16 (TestExporterTest.test_export_with_specific_branch): 17 * Scripts/webkitpy/w3c/wpt_linter.py: Added. 18 (WPTLinter): 19 (WPTLinter.__init__): 20 (WPTLinter.lint): 21 1 22 2018-03-23 David Kilzer <ddkilzer@apple.com> 2 23 -
trunk/Tools/Scripts/webkitpy/w3c/test_exporter.py
r229865 r229921 35 35 from webkitpy.common.webkit_finder import WebKitFinder 36 36 from webkitpy.w3c.wpt_github import WPTGitHub 37 from webkitpy.w3c.wpt_linter import WPTLinter 37 38 38 39 _log = logging.getLogger(__name__) … … 45 46 class TestExporter(object): 46 47 47 def __init__(self, host, options, gitClass=Git, bugzillaClass=Bugzilla, WPTGitHubClass=WPTGitHub ):48 def __init__(self, host, options, gitClass=Git, bugzillaClass=Bugzilla, WPTGitHubClass=WPTGitHub, WPTLinterClass=WPTLinter): 48 49 self._host = host 49 50 self._filesystem = host.filesystem … … 65 66 66 67 self._git = self._ensure_wpt_repository("https://github.com/w3c/web-platform-tests.git", self._options.repository_directory, gitClass) 68 self._linter = WPTLinterClass(self._options.repository_directory, host.filesystem) 67 69 68 70 self._username = options.username … … 240 242 if git_patch_file: 241 243 self._filesystem.remove(git_patch_file) 244 245 lint_errors = self._linter.lint() 246 if lint_errors: 247 _log.error("The wpt linter detected %s linting error(s). Please address the above errors before attempting to export changes to the web-platform-test repository." % (lint_errors,)) 248 self.delete_local_branch() 249 self.clean() 250 return 242 251 243 252 try: … … 296 305 return record.getMessage() 297 306 298 logger = logging.getLogger( )307 logger = logging.getLogger('webkitpy.w3c.test_exporter') 299 308 logger.setLevel(logging.INFO) 300 309 handler = LogHandler() -
trunk/Tools/Scripts/webkitpy/w3c/test_exporter_unittest.py
r229865 r229921 29 29 from webkitpy.w3c.wpt_github_mock import MockWPTGitHub 30 30 31 mock_linter = None 31 32 32 33 class TestExporterTest(unittest.TestCase): … … 106 107 return self._mockSCM 107 108 109 class MockWPTLinter(object): 110 def __init__(self, repository_directory, filesystem): 111 self.calls = [repository_directory] 112 # workaround to appease the style checker which thinks 113 # exporter._linter is an instance of WPTLinter and 114 # complains if we try to access the calls property which 115 # only exists on MockWPTLinter 116 global mock_linter 117 mock_linter = self 118 119 def lint(self): 120 self.calls.append('lint') 121 return 0 122 108 123 def test_export(self): 109 124 host = TestExporterTest.MyMockHost() 110 125 options = parse_args(['test_exporter.py', '-g', 'HEAD', '-b', '1234', '-c', '-n', 'USER', '-t', 'TOKEN']) 111 exporter = TestExporter(host, options, TestExporterTest.MockGit, TestExporterTest.MockBugzilla, MockWPTGitHub )126 exporter = TestExporter(host, options, TestExporterTest.MockGit, TestExporterTest.MockBugzilla, MockWPTGitHub, TestExporterTest.MockWPTLinter) 112 127 exporter.do_export() 113 128 self.assertEquals(exporter._github.calls, ['create_pr', 'add_label "webkit-export"']) … … 132 147 'fetch bug 1234', 133 148 'post comment to bug 1234 : Submitted web-platform-tests pull request: https://github.com/w3c/web-platform-tests/pull/5678']) 149 self.assertEquals(mock_linter.calls, ['/mock-checkout/WebKitBuild/w3c-tests/web-platform-tests', 'lint']) 134 150 135 151 def test_export_with_specific_branch(self): 136 152 host = TestExporterTest.MyMockHost() 137 153 options = parse_args(['test_exporter.py', '-g', 'HEAD', '-b', '1234', '-c', '-n', 'USER', '-t', 'TOKEN', '-bn', 'wpt-export-branch']) 138 exporter = TestExporter(host, options, TestExporterTest.MockGit, TestExporterTest.MockBugzilla, MockWPTGitHub )154 exporter = TestExporter(host, options, TestExporterTest.MockGit, TestExporterTest.MockBugzilla, MockWPTGitHub, TestExporterTest.MockWPTLinter) 139 155 exporter.do_export() 140 156 self.assertEquals(exporter._git.calls, [
Note: See TracChangeset
for help on using the changeset viewer.