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

Side by Side Diff: third_party/WebKit/Tools/Scripts/webkitpy/w3c/update_w3c_test_expectations_unittest.py

Issue 2277303003: In update-w3c-test-expectations, handle failure to fetch results. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 3 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
« no previous file with comments | « third_party/WebKit/Tools/Scripts/webkitpy/w3c/update_w3c_test_expectations.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2016 The Chromium Authors. All rights reserved. 1 # Copyright 2016 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 unittest 5 import unittest
6 6
7 from webkitpy.common.host_mock import MockHost 7 from webkitpy.common.host_mock import MockHost
8 from webkitpy.common.net.buildbot import Build
9 from webkitpy.common.net.buildbot_mock import MockBuildBot
10 from webkitpy.common.net.layouttestresults import LayoutTestResult, LayoutTestRe sults
8 from webkitpy.common.webkit_finder import WebKitFinder 11 from webkitpy.common.webkit_finder import WebKitFinder
9 from webkitpy.common.net.layouttestresults import LayoutTestResult 12 from webkitpy.layout_tests.builder_list import BuilderList
10 from webkitpy.w3c.update_w3c_test_expectations import W3CExpectationsLineAdder 13 from webkitpy.w3c.update_w3c_test_expectations import W3CExpectationsLineAdder
11 14
12 15
13 class UpdateW3CTestExpectationsTest(unittest.TestCase, W3CExpectationsLineAdder) : 16 class UpdateW3CTestExpectationsTest(unittest.TestCase, W3CExpectationsLineAdder) :
qyearsley 2016/08/25 16:02:47 Another TODO which I plan to do as an immediate fo
14 17
15 def setUp(self): 18 def setUp(self):
16 self.host = MockHost() 19 self.host = MockHost()
17 self.mock_dict_one = { 20 self.mock_dict_one = {
18 'fake/test/path.html': { 21 'fake/test/path.html': {
19 'one': {'expected': 'FAIL', 'actual': 'PASS', 'bug': 'crbug.com/ 626703'}, 22 'one': {'expected': 'FAIL', 'actual': 'PASS', 'bug': 'crbug.com/ 626703'},
20 'two': {'expected': 'FAIL', 'actual': 'PASS', 'bug': 'crbug.com/ 626703'} 23 'two': {'expected': 'FAIL', 'actual': 'PASS', 'bug': 'crbug.com/ 626703'}
21 } 24 }
22 } 25 }
23 self.mock_dict_two = { 26 self.mock_dict_two = {
24 'imported/fake/test/path.html': { 27 'imported/fake/test/path.html': {
25 'one': {'expected': 'FAIL', 'actual': 'PASS', 'bug': 'crbug.com/ 626703'}, 28 'one': {'expected': 'FAIL', 'actual': 'PASS', 'bug': 'crbug.com/ 626703'},
26 'two': {'expected': 'FAIL', 'actual': 'TIMEOUT', 'bug': 'crbug.c om/626703'}, 29 'two': {'expected': 'FAIL', 'actual': 'TIMEOUT', 'bug': 'crbug.c om/626703'},
27 'three': {'expected': 'FAIL', 'actual': 'PASS', 'bug': 'crbug.co m/626703'} 30 'three': {'expected': 'FAIL', 'actual': 'PASS', 'bug': 'crbug.co m/626703'}
28 } 31 }
29 } 32 }
30 self.mock_dict_three = { 33 self.mock_dict_three = {
31 'imported/fake/test/path.html': { 34 'imported/fake/test/path.html': {
32 'four': {'expected': 'FAIL', 'actual': 'PASS', 'bug': 'crbug.com /626703'}} 35 'four': {'expected': 'FAIL', 'actual': 'PASS', 'bug': 'crbug.com /626703'}}
33 } 36 }
34 self.mock_dict_four = { 37 self.mock_dict_four = {
35 'imported/fake/test/path.html': { 38 'imported/fake/test/path.html': {
36 'one': {'expected': 'FAIL', 'actual': 'TIMEOUT', 'bug': 'crbug.c om/626703'} 39 'one': {'expected': 'FAIL', 'actual': 'TIMEOUT', 'bug': 'crbug.c om/626703'}
37 } 40 }
38 } 41 }
42 self.host.builders = BuilderList({
43 'mac': {'port_name': 'test-mac'},
44 })
45
46 def tearDown(self):
47 self.host = None
48
49 def test_get_failing_results_dict_only_passing_results(self):
50 self.host.buildbot.set_results(Build('mac', 123), LayoutTestResults({
51 'tests': {
52 'fake': {
53 'test.html': {
54 'passing-test.html': {
55 'expected': 'PASS',
56 'actual': 'PASS',
57 },
58 },
59 },
60 },
61 }))
62 line_adder = W3CExpectationsLineAdder(self.host)
63 self.assertEqual(line_adder.get_failing_results_dict(self.host.buildbot, 'mac', 123), {})
64
65 def test_get_failing_results_dict_no_results(self):
66 self.host.buildbot = MockBuildBot()
67 self.host.buildbot.set_results(Build('mac', 123), None)
68 line_adder = W3CExpectationsLineAdder(self.host)
69 self.assertEqual(line_adder.get_failing_results_dict(self.host.buildbot, 'mac', 123), {})
70
71 def test_get_failing_results_dict_some_failing_results(self):
72 self.host.buildbot.set_results(Build('mac', 123), LayoutTestResults({
73 'tests': {
74 'fake': {
75 'test.html': {
76 'failing-test.html': {
77 'expected': 'PASS',
78 'actual': 'IMAGE',
79 'is_unexpected': True,
80 },
81 },
82 },
83 },
84 }))
85 line_adder = W3CExpectationsLineAdder(self.host)
86 self.assertEqual(line_adder.get_failing_results_dict(self.host.buildbot, 'mac', 123), {
87 'fake/test.html/failing-test.html': {
88 'Mac': {
89 'actual': 'IMAGE',
90 'expected': 'PASS',
91 'bug': 'crbug.com/626703',
92 },
93 },
94 })
39 95
40 def test_merge_same_valued_keys(self): 96 def test_merge_same_valued_keys(self):
41 self.assertEqual( 97 self.assertEqual(
42 self.merge_same_valued_keys(self.mock_dict_one['fake/test/path.html' ]), 98 self.merge_same_valued_keys(self.mock_dict_one['fake/test/path.html' ]),
43 {('two', 'one'): {'expected': 'FAIL', 'actual': 'PASS', 'bug': 'crbu g.com/626703'}}) 99 {('two', 'one'): {'expected': 'FAIL', 'actual': 'PASS', 'bug': 'crbu g.com/626703'}})
44 self.assertEqual( 100 self.assertEqual(
45 self.merge_same_valued_keys(self.mock_dict_two['imported/fake/test/p ath.html']), 101 self.merge_same_valued_keys(self.mock_dict_two['imported/fake/test/p ath.html']),
46 { 102 {
47 ('three', 'one'): {'expected': 'FAIL', 'actual': 'PASS', 'bug': 'crbug.com/626703'}, 103 ('three', 'one'): {'expected': 'FAIL', 'actual': 'PASS', 'bug': 'crbug.com/626703'},
48 'two': {'expected': 'FAIL', 'actual': 'TIMEOUT', 'bug': 'crbug.c om/626703'} 104 'two': {'expected': 'FAIL', 'actual': 'TIMEOUT', 'bug': 'crbug.c om/626703'}
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 self.host.filesystem.files['/mock-checkout/imported/fake/test/path.html' ] = ''' 209 self.host.filesystem.files['/mock-checkout/imported/fake/test/path.html' ] = '''
154 <script src="/resources/testharness.js"></script>''' 210 <script src="/resources/testharness.js"></script>'''
155 finder = WebKitFinder(self.host.filesystem) 211 finder = WebKitFinder(self.host.filesystem)
156 line_adder = W3CExpectationsLineAdder(self.host) 212 line_adder = W3CExpectationsLineAdder(self.host)
157 tests = ['imported/fake/test/path.html'] 213 tests = ['imported/fake/test/path.html']
158 test_dict = {'../../../imported/fake/test/path.html': self.mock_dict_two ['imported/fake/test/path.html']} 214 test_dict = {'../../../imported/fake/test/path.html': self.mock_dict_two ['imported/fake/test/path.html']}
159 tests_to_rebaseline, tests_results = line_adder.get_tests_to_rebaseline( 215 tests_to_rebaseline, tests_results = line_adder.get_tests_to_rebaseline(
160 finder, tests, test_dict) 216 finder, tests, test_dict)
161 self.assertEqual(tests_to_rebaseline, ['../../../imported/fake/test/path .html']) 217 self.assertEqual(tests_to_rebaseline, ['../../../imported/fake/test/path .html'])
162 self.assertEqual(tests_results, test_dict) 218 self.assertEqual(tests_results, test_dict)
OLDNEW
« no previous file with comments | « third_party/WebKit/Tools/Scripts/webkitpy/w3c/update_w3c_test_expectations.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698