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

Side by Side Diff: sky/tools/webkitpy/tool/commands/flakytests_unittest.py

Issue 675343003: Prune a bunch of webkitpy. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years, 1 month 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
(Empty)
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
3 # found in the LICENSE file.
4
5 import flakytests
6
7 from webkitpy.common.checkout.scm.scm_mock import MockSCM
8 from webkitpy.tool.commands.commandtest import CommandsTest
9 from webkitpy.tool.mocktool import MockTool, MockOptions
10
11
12 class FakeBotTestExpectations(object):
13 def expectation_lines(self, only_ignore_very_flaky=False):
14 return []
15
16
17 class FakeBotTestExpectationsFactory(object):
18 def expectations_for_builder(self, builder):
19 return FakeBotTestExpectations()
20
21
22 class ChangedExpectationsMockSCM(MockSCM):
23 def changed_files(self):
24 return ['tests/FlakyTests']
25
26
27 class FlakyTestsTest(CommandsTest):
28 def test_simple(self):
29 command = flakytests.FlakyTests()
30 factory = FakeBotTestExpectationsFactory()
31 lines = command._collect_expectation_lines(['foo'], factory)
32 self.assertEqual(lines, [])
33
34 def test_integration(self):
35 command = flakytests.FlakyTests()
36 tool = MockTool()
37 command.expectations_factory = FakeBotTestExpectationsFactory
38 options = MockOptions(upload=True)
39 expected_stdout = """Updated /mock-checkout/third_party/WebKit/tests/Fla kyTests
40 tests/FlakyTests is not changed, not uploading.
41 """
42 self.assert_execute_outputs(command, options=options, tool=tool, expecte d_stdout=expected_stdout)
43
44 port = tool.port_factory.get()
45 self.assertEqual(tool.filesystem.read_text_file(tool.filesystem.join(por t.layout_tests_dir(), 'FlakyTests')), command.FLAKY_TEST_CONTENTS % '')
46
47 def test_integration_uploads(self):
48 command = flakytests.FlakyTests()
49 tool = MockTool()
50 tool.scm = ChangedExpectationsMockSCM
51 command.expectations_factory = FakeBotTestExpectationsFactory
52 reviewer = 'foo@chromium.org'
53 options = MockOptions(upload=True, reviewers=reviewer)
54 expected_stdout = """Updated /mock-checkout/third_party/WebKit/tests/Fla kyTests
55 """
56 self.assert_execute_outputs(command, options=options, tool=tool, expecte d_stdout=expected_stdout)
57 self.assertEqual(tool.executive.calls,
58 [
59 ['git', 'commit', '-m', command.COMMIT_MESSAGE % reviewer, '/moc k-checkout/third_party/WebKit/tests/FlakyTests'],
60 ['git', 'cl', 'upload', '--send-mail', '-f', '--cc', 'ojan@chrom ium.org,dpranke@chromium.org,eseidel@chromium.org'],
61 ])
62
63 port = tool.port_factory.get()
64 self.assertEqual(tool.filesystem.read_text_file(tool.filesystem.join(por t.layout_tests_dir(), 'FlakyTests')), command.FLAKY_TEST_CONTENTS % '')
OLDNEW
« no previous file with comments | « sky/tools/webkitpy/tool/commands/flakytests.py ('k') | sky/tools/webkitpy/tool/commands/rebaselineserver.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698