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

Unified Diff: Tools/Scripts/webkitpy/tool/commands/flakytests_unittest.py

Issue 312103005: Minor cleanups to flakytests.py (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: address review comments Created 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Tools/Scripts/webkitpy/tool/commands/flakytests.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Tools/Scripts/webkitpy/tool/commands/flakytests_unittest.py
diff --git a/Tools/Scripts/webkitpy/tool/commands/flakytests_unittest.py b/Tools/Scripts/webkitpy/tool/commands/flakytests_unittest.py
index a602557ba3c25730518470ca40a74eac79098cb1..d3d2ed5f667a20a7b61919e7c8789bc50e5d6c57 100644
--- a/Tools/Scripts/webkitpy/tool/commands/flakytests_unittest.py
+++ b/Tools/Scripts/webkitpy/tool/commands/flakytests_unittest.py
@@ -2,11 +2,12 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
+import flakytests
+
+from webkitpy.common.checkout.scm.scm_mock import MockSCM
from webkitpy.tool.commands.commandtest import CommandsTest
from webkitpy.tool.mocktool import MockTool, MockOptions
-import flakytests
-
class FakeBotTestExpectations(object):
def expectation_lines(self, only_ignore_very_flaky=False):
@@ -18,6 +19,11 @@ class FakeBotTestExpectationsFactory(object):
return FakeBotTestExpectations()
+class ChangedExpectationsMockSCM(MockSCM):
+ def changed_files(self):
+ return ['LayoutTests/FlakyTests']
+
+
class FlakyTestsTest(CommandsTest):
def test_simple(self):
command = flakytests.FlakyTests()
@@ -27,9 +33,32 @@ class FlakyTestsTest(CommandsTest):
def test_integration(self):
command = flakytests.FlakyTests()
+ tool = MockTool()
command.expectations_factory = FakeBotTestExpectationsFactory
options = MockOptions(upload=True)
expected_stdout = """Updated /mock-checkout/third_party/WebKit/LayoutTests/FlakyTests
LayoutTests/FlakyTests is not changed, not uploading.
"""
- self.assert_execute_outputs(command, options=options, expected_stdout=expected_stdout)
+ self.assert_execute_outputs(command, options=options, tool=tool, expected_stdout=expected_stdout)
+
+ port = tool.port_factory.get()
+ self.assertEqual(tool.filesystem.read_text_file(tool.filesystem.join(port.layout_tests_dir(), 'FlakyTests')), command.FLAKY_TEST_CONTENTS % '')
+
+ def test_integration_uploads(self):
+ command = flakytests.FlakyTests()
+ tool = MockTool()
+ tool.scm = ChangedExpectationsMockSCM
+ command.expectations_factory = FakeBotTestExpectationsFactory
+ reviewer = 'foo@chromium.org'
+ options = MockOptions(upload=True, reviewers=reviewer)
+ expected_stdout = """Updated /mock-checkout/third_party/WebKit/LayoutTests/FlakyTests
+"""
+ self.assert_execute_outputs(command, options=options, tool=tool, expected_stdout=expected_stdout)
+ self.assertEqual(tool.executive.calls,
+ [
+ ['git', 'commit', '-m', command.COMMIT_MESSAGE % reviewer, '/mock-checkout/third_party/WebKit/LayoutTests/FlakyTests'],
+ ['git', 'cl', 'upload', '--send-mail', '-f', '--cc', 'ojan@chromium.org,dpranke@chromium.org,eseidel@chromium.org'],
+ ])
+
+ port = tool.port_factory.get()
+ self.assertEqual(tool.filesystem.read_text_file(tool.filesystem.join(port.layout_tests_dir(), 'FlakyTests')), command.FLAKY_TEST_CONTENTS % '')
« no previous file with comments | « Tools/Scripts/webkitpy/tool/commands/flakytests.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698