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

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: add newline at end of FlakyTests 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
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..f4fff9771628deed3347cf4f49ad1a0971588a62 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,47 @@ 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)
+
+ expected_flaky_tests_content = '''# This file is generated by webkit-patch update-flaky-tests from the flakiness dashboard data.
+# Manual changes will be overwritten.
+
+
+'''
+ port = tool.port_factory.get()
+ self.assertEqual(tool.filesystem.read_text_file(tool.filesystem.join(port.layout_tests_dir(), 'FlakyTests')), expected_flaky_tests_content)
+
+ def test_integration_uploads(self):
+ command = flakytests.FlakyTests()
+ tool = MockTool()
+ tool.scm = ChangedExpectationsMockSCM
+ command.expectations_factory = FakeBotTestExpectationsFactory
+ options = MockOptions(upload=True, reviewers='foo@chromium.org')
+ 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', '''Update FlakyTests to match current flakiness dashboard results
+
+Automatically generated using:
+webkit-patch update-flaky-tests
+
+R=foo@chromium.org
+''', '/mock-checkout/third_party/WebKit/LayoutTests/FlakyTests'],
+ ['git', 'cl', 'upload', '--send-mail', '-f', '--cc', 'ojan@chromium.org,dpranke@chromium.org,eseidel@chromium.org'],
+ ])
+
+ expected_flaky_tests_content = '''# This file is generated by webkit-patch update-flaky-tests from the flakiness dashboard data.
+# Manual changes will be overwritten.
+
+
+'''
+ port = tool.port_factory.get()
+ self.assertEqual(tool.filesystem.read_text_file(tool.filesystem.join(port.layout_tests_dir(), 'FlakyTests')), expected_flaky_tests_content)

Powered by Google App Engine
This is Rietveld 408576698