Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(463)

Side by Side Diff: Tools/Scripts/webkitpy/tool/commands/queries_unittest.py

Issue 17639006: Remove committer list, bugzilla, watchlist code and transitive closure of stuff. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: merge on top of thakis' change in r153020 Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 # Copyright (C) 2009 Google Inc. All rights reserved. 1 # Copyright (C) 2009 Google Inc. All rights reserved.
2 # Copyright (C) 2012 Intel Corporation. All rights reserved. 2 # Copyright (C) 2012 Intel Corporation. All rights reserved.
3 # 3 #
4 # Redistribution and use in source and binary forms, with or without 4 # Redistribution and use in source and binary forms, with or without
5 # modification, are permitted provided that the following conditions are 5 # modification, are permitted provided that the following conditions are
6 # met: 6 # met:
7 # 7 #
8 # * Redistributions of source code must retain the above copyright 8 # * Redistributions of source code must retain the above copyright
9 # notice, this list of conditions and the following disclaimer. 9 # notice, this list of conditions and the following disclaimer.
10 # * Redistributions in binary form must reproduce the above 10 # * Redistributions in binary form must reproduce the above
(...skipping 12 matching lines...) Expand all
23 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 23 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 29
30 import unittest2 as unittest 30 import unittest2 as unittest
31 31
32 from webkitpy.common.system.outputcapture import OutputCapture 32 from webkitpy.common.system.outputcapture import OutputCapture
33 from webkitpy.common.net.bugzilla import Bugzilla
34 from webkitpy.common.system.outputcapture import OutputCapture 33 from webkitpy.common.system.outputcapture import OutputCapture
35 from webkitpy.thirdparty.mock import Mock 34 from webkitpy.thirdparty.mock import Mock
36 from webkitpy.layout_tests.port.test import TestPort 35 from webkitpy.layout_tests.port.test import TestPort
37 from webkitpy.tool.commands.commandtest import CommandsTest 36 from webkitpy.tool.commands.commandtest import CommandsTest
38 from webkitpy.tool.commands.queries import * 37 from webkitpy.tool.commands.queries import *
39 from webkitpy.tool.mocktool import MockTool, MockOptions 38 from webkitpy.tool.mocktool import MockTool, MockOptions
40 39
41 40
42 class MockTestPort1(object): 41 class MockTestPort1(object):
43 def skips_layout_test(self, test_name): 42 def skips_layout_test(self, test_name):
(...skipping 13 matching lines...) Expand all
57 } 56 }
58 57
59 def all_port_names(self, options=None): 58 def all_port_names(self, options=None):
60 return self._all_ports.keys() 59 return self._all_ports.keys()
61 60
62 def get(self, port_name): 61 def get(self, port_name):
63 return self._all_ports.get(port_name) 62 return self._all_ports.get(port_name)
64 63
65 64
66 class QueryCommandsTest(CommandsTest): 65 class QueryCommandsTest(CommandsTest):
67 def test_bugs_to_commit(self):
68 expected_logs = "Warning, attachment 10001 on bug 50000 has invalid comm itter (non-committer@example.com)\n"
69 self.assert_execute_outputs(BugsToCommit(), None, "50000\n50003\n", expe cted_logs=expected_logs)
70
71 def test_patches_in_commit_queue(self):
72 expected_stdout = "http://example.com/10000\nhttp://example.com/10002\n"
73 expected_logs = "Warning, attachment 10001 on bug 50000 has invalid comm itter (non-committer@example.com)\nPatches in commit queue:\n"
74 self.assert_execute_outputs(PatchesInCommitQueue(), None, expected_stdou t, expected_logs=expected_logs)
75
76 def test_patches_to_commit_queue(self):
77 expected_stdout = "http://example.com/10003&action=edit\n"
78 expected_logs = "10000 already has cq=+\n10001 already has cq=+\n10004 c ommitter = \"Eric Seidel\" <eric@webkit.org>\n"
79 options = Mock()
80 options.bugs = False
81 self.assert_execute_outputs(PatchesToCommitQueue(), None, expected_stdou t, expected_logs=expected_logs, options=options)
82
83 expected_stdout = "http://example.com/50003\n"
84 options.bugs = True
85 self.assert_execute_outputs(PatchesToCommitQueue(), None, expected_stdou t, expected_logs=expected_logs, options=options)
86
87 def test_patches_to_review(self):
88 options = Mock()
89
90 # When no cc_email is provided, we use the Bugzilla username by default.
91 # The MockBugzilla will fake the authentication using username@webkit.or g
92 # as login and it should match the username at the report header.
93 options.cc_email = None
94 options.include_cq_denied = False
95 options.all = False
96 expected_stdout = \
97 "Bugs with attachments pending review that has username@webkit.org i n the CC list:\n" \
98 "http://webkit.org/b/bugid Description (age in days)\n" \
99 "Total: 0\n"
100 expected_stderr = ""
101 self.assert_execute_outputs(PatchesToReview(), None, expected_stdout, ex pected_stderr, options=options)
102
103 options.cc_email = "abarth@webkit.org"
104 options.include_cq_denied = True
105 options.all = False
106 expected_stdout = \
107 "Bugs with attachments pending review that has abarth@webkit.org in the CC list:\n" \
108 "http://webkit.org/b/bugid Description (age in days)\n" \
109 "http://webkit.org/b/50001 Bug with a patch needing review. (0)\n" \
110 "Total: 1\n"
111 expected_stderr = ""
112 self.assert_execute_outputs(PatchesToReview(), None, expected_stdout, ex pected_stderr, options=options)
113
114 options.cc_email = None
115 options.include_cq_denied = True
116 options.all = True
117 expected_stdout = \
118 "Bugs with attachments pending review:\n" \
119 "http://webkit.org/b/bugid Description (age in days)\n" \
120 "http://webkit.org/b/50001 Bug with a patch needing review. (0)\n" \
121 "Total: 1\n"
122 self.assert_execute_outputs(PatchesToReview(), None, expected_stdout, ex pected_stderr, options=options)
123
124 options.cc_email = None
125 options.include_cq_denied = False
126 options.all = True
127 expected_stdout = \
128 "Bugs with attachments pending review:\n" \
129 "http://webkit.org/b/bugid Description (age in days)\n" \
130 "Total: 0\n"
131 self.assert_execute_outputs(PatchesToReview(), None, expected_stdout, ex pected_stderr, options=options)
132
133 options.cc_email = "invalid_email@example.com"
134 options.all = False
135 options.include_cq_denied = True
136 expected_stdout = \
137 "Bugs with attachments pending review that has invalid_email@example .com in the CC list:\n" \
138 "http://webkit.org/b/bugid Description (age in days)\n" \
139 "Total: 0\n"
140 self.assert_execute_outputs(PatchesToReview(), None, expected_stdout, ex pected_stderr, options=options)
141
142 def test_tree_status(self): 66 def test_tree_status(self):
143 expected_stdout = "ok : Builder1\nok : Builder2\n" 67 expected_stdout = "ok : Builder1\nok : Builder2\n"
144 self.assert_execute_outputs(TreeStatus(), None, expected_stdout) 68 self.assert_execute_outputs(TreeStatus(), None, expected_stdout)
145 69
146 70
147 class FailureReasonTest(unittest.TestCase):
148 def test_blame_line_for_revision(self):
149 tool = MockTool()
150 command = FailureReason()
151 command.bind_to_tool(tool)
152 # This is an artificial example, mostly to test the CommitInfo lookup fa ilure case.
153 self.assertEqual(command._blame_line_for_revision(0), "FAILED to fetch C ommitInfo for r0, likely missing ChangeLog")
154
155 def raising_mock(self):
156 raise Exception("MESSAGE")
157 tool.checkout().commit_info_for_revision = raising_mock
158 self.assertEqual(command._blame_line_for_revision(0), "FAILED to fetch C ommitInfo for r0, exception: MESSAGE")
159
160
161 class PrintExpectationsTest(unittest.TestCase): 71 class PrintExpectationsTest(unittest.TestCase):
162 def run_test(self, tests, expected_stdout, platform='test-win-xp', **args): 72 def run_test(self, tests, expected_stdout, platform='test-win-xp', **args):
163 options = MockOptions(all=False, csv=False, full=False, platform=platfor m, 73 options = MockOptions(all=False, csv=False, full=False, platform=platfor m,
164 include_keyword=[], exclude_keyword=[], paths=Fals e).update(**args) 74 include_keyword=[], exclude_keyword=[], paths=Fals e).update(**args)
165 tool = MockTool() 75 tool = MockTool()
166 tool.port_factory.all_port_names = lambda: TestPort.ALL_BASELINE_VARIANT S 76 tool.port_factory.all_port_names = lambda: TestPort.ALL_BASELINE_VARIANT S
167 command = PrintExpectations() 77 command = PrintExpectations()
168 command.bind_to_tool(tool) 78 command.bind_to_tool(tool)
169 79
170 oc = OutputCapture() 80 oc = OutputCapture()
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
273 183
274 def test_csv(self): 184 def test_csv(self):
275 command = PrintBaselines() 185 command = PrintBaselines()
276 command.bind_to_tool(self.tool) 186 command.bind_to_tool(self.tool)
277 self.capture_output() 187 self.capture_output()
278 command.execute(MockOptions(all=False, platform='*xp', csv=True, include _virtual_tests=False), ['passes/text.html'], self.tool) 188 command.execute(MockOptions(all=False, platform='*xp', csv=True, include _virtual_tests=False), ['passes/text.html'], self.tool)
279 stdout, _, _ = self.restore_output() 189 stdout, _, _ = self.restore_output()
280 self.assertMultiLineEqual(stdout, 190 self.assertMultiLineEqual(stdout,
281 ('test-win-xp,passes/text.html,None,png,passes/text-ex pected.png,None\n' 191 ('test-win-xp,passes/text.html,None,png,passes/text-ex pected.png,None\n'
282 'test-win-xp,passes/text.html,None,txt,passes/text-ex pected.txt,None\n')) 192 'test-win-xp,passes/text.html,None,txt,passes/text-ex pected.txt,None\n'))
OLDNEW
« no previous file with comments | « Tools/Scripts/webkitpy/tool/commands/queries.py ('k') | Tools/Scripts/webkitpy/tool/steps/__init__.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698