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

Side by Side Diff: third_party/WebKit/Tools/Scripts/webkitpy/tool/commands/flakytests_unittest.py

Issue 1839193004: Run auto-formatter (autopep8) on webkitpy. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased Created 4 years, 8 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
OLDNEW
1 # Copyright 2014 The Chromium Authors. All rights reserved. 1 # Copyright 2014 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 import flakytests 5 import flakytests
6 6
7 from webkitpy.common.checkout.scm.scm_mock import MockSCM 7 from webkitpy.common.checkout.scm.scm_mock import MockSCM
8 from webkitpy.layout_tests.layout_package import bot_test_expectations 8 from webkitpy.layout_tests.layout_package import bot_test_expectations
9 from webkitpy.layout_tests.port import builders 9 from webkitpy.layout_tests.port import builders
10 from webkitpy.tool.commands.commandtest import CommandsTest 10 from webkitpy.tool.commands.commandtest import CommandsTest
11 from webkitpy.tool.mocktool import MockTool, MockOptions 11 from webkitpy.tool.mocktool import MockTool, MockOptions
12 12
13
13 class FakeBotTestExpectations(object): 14 class FakeBotTestExpectations(object):
15
14 def expectation_lines(self, only_ignore_very_flaky=False): 16 def expectation_lines(self, only_ignore_very_flaky=False):
15 return [] 17 return []
16 18
17 19
18 class FakeBotTestExpectationsFactory(object): 20 class FakeBotTestExpectationsFactory(object):
19 FAILURE_MAP = {"A": "AUDIO", "C": "CRASH", "F": "TEXT", "I": "IMAGE", "O": " MISSING", 21 FAILURE_MAP = {"A": "AUDIO", "C": "CRASH", "F": "TEXT", "I": "IMAGE", "O": " MISSING",
20 "N": "NO DATA", "P": "PASS", "T": "TIMEOUT", "Y": "NOTRUN", " X": "SKIP", 22 "N": "NO DATA", "P": "PASS", "T": "TIMEOUT", "Y": "NOTRUN", " X": "SKIP",
21 "Z": "IMAGE+TEXT", "K": "LEAK"} 23 "Z": "IMAGE+TEXT", "K": "LEAK"}
22 24
23 def _expectations_from_test_data(self, builder, test_data): 25 def _expectations_from_test_data(self, builder, test_data):
(...skipping 16 matching lines...) Expand all
40 return self._expectations_from_test_data(builder, { 42 return self._expectations_from_test_data(builder, {
41 'tests': { 43 'tests': {
42 'pass.html': {'results': [[2, 'TTTP']], 'expected': 'PASS'}, 44 'pass.html': {'results': [[2, 'TTTP']], 'expected': 'PASS'},
43 } 45 }
44 }) 46 })
45 47
46 return FakeBotTestExpectations() 48 return FakeBotTestExpectations()
47 49
48 50
49 class FlakyTestsTest(CommandsTest): 51 class FlakyTestsTest(CommandsTest):
52
50 def test_merge_lines(self): 53 def test_merge_lines(self):
51 command = flakytests.FlakyTests() 54 command = flakytests.FlakyTests()
52 factory = FakeBotTestExpectationsFactory() 55 factory = FakeBotTestExpectationsFactory()
53 56
54 old_builders = builders._exact_matches 57 old_builders = builders._exact_matches
55 builders._exact_matches = { 58 builders._exact_matches = {
56 "foo-builder": {"port_name": "dummy-port", "specifiers": ['Linux', ' Release']}, 59 "foo-builder": {"port_name": "dummy-port", "specifiers": ['Linux', ' Release']},
57 "bar-builder": {"port_name": "dummy-port", "specifiers": ['Mac', 'De bug']}, 60 "bar-builder": {"port_name": "dummy-port", "specifiers": ['Mac', 'De bug']},
58 } 61 }
59 62
60 try: 63 try:
61 lines = command._collect_expectation_lines(['foo-builder', 'bar-buil der'], factory) 64 lines = command._collect_expectation_lines(['foo-builder', 'bar-buil der'], factory)
62 self.assertEqual(len(lines), 1) 65 self.assertEqual(len(lines), 1)
63 self.assertEqual(lines[0].expectations, ['TEXT', 'TIMEOUT', 'PASS']) 66 self.assertEqual(lines[0].expectations, ['TEXT', 'TIMEOUT', 'PASS'])
64 self.assertEqual(lines[0].specifiers, ['Mac', 'Linux']) 67 self.assertEqual(lines[0].specifiers, ['Mac', 'Linux'])
65 finally: 68 finally:
66 builders._exact_matches = old_builders 69 builders._exact_matches = old_builders
67 70
68
69 def test_integration(self): 71 def test_integration(self):
70 command = flakytests.FlakyTests() 72 command = flakytests.FlakyTests()
71 tool = MockTool() 73 tool = MockTool()
72 command.expectations_factory = FakeBotTestExpectationsFactory 74 command.expectations_factory = FakeBotTestExpectationsFactory
73 options = MockOptions(upload=True) 75 options = MockOptions(upload=True)
74 expected_stdout = flakytests.FlakyTests.OUTPUT % ( 76 expected_stdout = flakytests.FlakyTests.OUTPUT % (
75 flakytests.FlakyTests.HEADER, 77 flakytests.FlakyTests.HEADER,
76 '', 78 '',
77 flakytests.FlakyTests.FLAKINESS_DASHBOARD_URL % '') + '\n' 79 flakytests.FlakyTests.FLAKINESS_DASHBOARD_URL % '') + '\n'
78 80
79 self.assert_execute_outputs(command, options=options, tool=tool, expecte d_stdout=expected_stdout) 81 self.assert_execute_outputs(command, options=options, tool=tool, expecte d_stdout=expected_stdout)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698