Commit 2b40cf25 authored by John Budorick's avatar John Budorick Committed by Commit Bot

Disable each CLIHelpersUnittest individually.

Bug: 938487
No-Try: true
Change-Id: I887735faee58cfe04e74359107ed4ab8d15a8ece
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1507196
Auto-Submit: John Budorick <jbudorick@chromium.org>
Reviewed-by: default avatarPeter Williamson <petewil@chromium.org>
Reviewed-by: default avatarSergiy Belozorov <sergiyb@chromium.org>
Reviewed-by: default avatarJuan Antonio Navarro Pérez <perezju@chromium.org>
Commit-Queue: Sergiy Belozorov <sergiyb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#638512}
parent 704e476b
...@@ -11,36 +11,44 @@ from core import cli_helpers ...@@ -11,36 +11,44 @@ from core import cli_helpers
from telemetry import decorators from telemetry import decorators
# https://crbug.com/938487
@decorators.Disabled('all')
class CLIHelpersTest(unittest.TestCase): class CLIHelpersTest(unittest.TestCase):
def testUnsupportedColor(self): def testUnsupportedColor(self):
with self.assertRaises(AssertionError): with self.assertRaises(AssertionError):
cli_helpers.Colored('message', 'pink') cli_helpers.Colored('message', 'pink')
@mock.patch('__builtin__.print') @mock.patch('__builtin__.print')
# https://crbug.com/938487
@decorators.Disabled('all')
def testPrintsInfo(self, print_mock): def testPrintsInfo(self, print_mock):
cli_helpers.Info('foo {sval} {ival}', sval='s', ival=42) cli_helpers.Info('foo {sval} {ival}', sval='s', ival=42)
print_mock.assert_called_once_with('foo s 42') print_mock.assert_called_once_with('foo s 42')
@mock.patch('__builtin__.print') @mock.patch('__builtin__.print')
# https://crbug.com/938487
@decorators.Disabled('all')
def testPrintsComment(self, print_mock): def testPrintsComment(self, print_mock):
cli_helpers.Comment('foo') cli_helpers.Comment('foo')
print_mock.assert_called_once_with('\033[93mfoo\033[0m') print_mock.assert_called_once_with('\033[93mfoo\033[0m')
@mock.patch('__builtin__.print') @mock.patch('__builtin__.print')
@mock.patch('sys.exit') @mock.patch('sys.exit')
# https://crbug.com/938487
@decorators.Disabled('all')
def testFatal(self, sys_exit_mock, print_mock): def testFatal(self, sys_exit_mock, print_mock):
cli_helpers.Fatal('foo') cli_helpers.Fatal('foo')
print_mock.assert_called_once_with('\033[91mfoo\033[0m') print_mock.assert_called_once_with('\033[91mfoo\033[0m')
sys_exit_mock.assert_called_once() sys_exit_mock.assert_called_once()
@mock.patch('__builtin__.print') @mock.patch('__builtin__.print')
# https://crbug.com/938487
@decorators.Disabled('all')
def testPrintsError(self, print_mock): def testPrintsError(self, print_mock):
cli_helpers.Error('foo') cli_helpers.Error('foo')
print_mock.assert_called_once_with('\033[91mfoo\033[0m') print_mock.assert_called_once_with('\033[91mfoo\033[0m')
@mock.patch('__builtin__.print') @mock.patch('__builtin__.print')
# https://crbug.com/938487
@decorators.Disabled('all')
def testPrintsStep(self, print_mock): def testPrintsStep(self, print_mock):
long_step_name = 'foobar' * 15 long_step_name = 'foobar' * 15
cli_helpers.Step(long_step_name) cli_helpers.Step(long_step_name)
...@@ -52,6 +60,8 @@ class CLIHelpersTest(unittest.TestCase): ...@@ -52,6 +60,8 @@ class CLIHelpersTest(unittest.TestCase):
@mock.patch('__builtin__.print') @mock.patch('__builtin__.print')
@mock.patch('__builtin__.raw_input') @mock.patch('__builtin__.raw_input')
# https://crbug.com/938487
@decorators.Disabled('all')
def testAskAgainOnInvalidAnswer(self, raw_input_mock, print_mock): def testAskAgainOnInvalidAnswer(self, raw_input_mock, print_mock):
raw_input_mock.side_effect = ['foobar', 'y'] raw_input_mock.side_effect = ['foobar', 'y']
self.assertTrue(cli_helpers.Ask('Ready?')) self.assertTrue(cli_helpers.Ask('Ready?'))
...@@ -63,6 +73,8 @@ class CLIHelpersTest(unittest.TestCase): ...@@ -63,6 +73,8 @@ class CLIHelpersTest(unittest.TestCase):
@mock.patch('__builtin__.print') @mock.patch('__builtin__.print')
@mock.patch('__builtin__.raw_input') @mock.patch('__builtin__.raw_input')
# https://crbug.com/938487
@decorators.Disabled('all')
def testAskWithCustomAnswersAndDefault(self, raw_input_mock, print_mock): def testAskWithCustomAnswersAndDefault(self, raw_input_mock, print_mock):
raw_input_mock.side_effect = [''] raw_input_mock.side_effect = ['']
self.assertFalse( self.assertFalse(
...@@ -72,6 +84,8 @@ class CLIHelpersTest(unittest.TestCase): ...@@ -72,6 +84,8 @@ class CLIHelpersTest(unittest.TestCase):
@mock.patch('__builtin__.print') @mock.patch('__builtin__.print')
@mock.patch('__builtin__.raw_input') @mock.patch('__builtin__.raw_input')
# https://crbug.com/938487
@decorators.Disabled('all')
def testAskNoDefaultCustomAnswersAsList(self, raw_input_mock, print_mock): def testAskNoDefaultCustomAnswersAsList(self, raw_input_mock, print_mock):
raw_input_mock.side_effect = ['', 'FoO'] raw_input_mock.side_effect = ['', 'FoO']
self.assertEqual(cli_helpers.Ask('Ready?', ['foo', 'bar']), 'foo') self.assertEqual(cli_helpers.Ask('Ready?', ['foo', 'bar']), 'foo')
...@@ -81,6 +95,8 @@ class CLIHelpersTest(unittest.TestCase): ...@@ -81,6 +95,8 @@ class CLIHelpersTest(unittest.TestCase):
mock.call('\033[96mReady? [foo/bar] \033[0m', end=' ') mock.call('\033[96mReady? [foo/bar] \033[0m', end=' ')
]) ])
# https://crbug.com/938487
@decorators.Disabled('all')
def testAskWithInvalidDefaultAnswer(self): def testAskWithInvalidDefaultAnswer(self):
with self.assertRaises(ValueError): with self.assertRaises(ValueError):
cli_helpers.Ask('Ready?', ['foo', 'bar'], 'baz') cli_helpers.Ask('Ready?', ['foo', 'bar'], 'baz')
...@@ -89,6 +105,8 @@ class CLIHelpersTest(unittest.TestCase): ...@@ -89,6 +105,8 @@ class CLIHelpersTest(unittest.TestCase):
@mock.patch('subprocess.check_call') @mock.patch('subprocess.check_call')
@mock.patch('__builtin__.open') @mock.patch('__builtin__.open')
@mock.patch('datetime.datetime') @mock.patch('datetime.datetime')
# https://crbug.com/938487
@decorators.Disabled('all')
def testCheckLog( def testCheckLog(
self, dt_mock, open_mock, check_call_mock, print_mock): self, dt_mock, open_mock, check_call_mock, print_mock):
file_mock = mock.Mock() file_mock = mock.Mock()
...@@ -115,6 +133,8 @@ class CLIHelpersTest(unittest.TestCase): ...@@ -115,6 +133,8 @@ class CLIHelpersTest(unittest.TestCase):
@mock.patch('subprocess.check_call') @mock.patch('subprocess.check_call')
@mock.patch('subprocess.call') @mock.patch('subprocess.call')
@mock.patch('__builtin__.open') @mock.patch('__builtin__.open')
# https://crbug.com/938487
@decorators.Disabled('all')
def testCheckLogError( def testCheckLogError(
self, open_mock, call_mock, check_call_mock, error_mock, print_mock): self, open_mock, call_mock, check_call_mock, error_mock, print_mock):
del print_mock, open_mock # Unused. del print_mock, open_mock # Unused.
...@@ -133,6 +153,8 @@ class CLIHelpersTest(unittest.TestCase): ...@@ -133,6 +153,8 @@ class CLIHelpersTest(unittest.TestCase):
@mock.patch('__builtin__.print') @mock.patch('__builtin__.print')
@mock.patch('subprocess.check_call') @mock.patch('subprocess.check_call')
# https://crbug.com/938487
@decorators.Disabled('all')
def testRun(self, check_call_mock, print_mock): def testRun(self, check_call_mock, print_mock):
check_call_mock.side_effect = [subprocess.CalledProcessError(87, ['cmd'])] check_call_mock.side_effect = [subprocess.CalledProcessError(87, ['cmd'])]
with self.assertRaises(subprocess.CalledProcessError): with self.assertRaises(subprocess.CalledProcessError):
...@@ -143,17 +165,23 @@ class CLIHelpersTest(unittest.TestCase): ...@@ -143,17 +165,23 @@ class CLIHelpersTest(unittest.TestCase):
@mock.patch('__builtin__.print') @mock.patch('__builtin__.print')
@mock.patch('subprocess.check_call') @mock.patch('subprocess.check_call')
# https://crbug.com/938487
@decorators.Disabled('all')
def testRunOkFail(self, check_call_mock, print_mock): def testRunOkFail(self, check_call_mock, print_mock):
del print_mock # Unused. del print_mock # Unused.
check_call_mock.side_effect = [subprocess.CalledProcessError(87, ['cmd'])] check_call_mock.side_effect = [subprocess.CalledProcessError(87, ['cmd'])]
cli_helpers.Run(['cmd'], ok_fail=True) cli_helpers.Run(['cmd'], ok_fail=True)
# https://crbug.com/938487
@decorators.Disabled('all')
def testRunWithNonListCommand(self): def testRunWithNonListCommand(self):
with self.assertRaises(ValueError): with self.assertRaises(ValueError):
cli_helpers.Run('cmd with args') cli_helpers.Run('cmd with args')
@mock.patch('__builtin__.print') @mock.patch('__builtin__.print')
@mock.patch('__builtin__.raw_input') @mock.patch('__builtin__.raw_input')
# https://crbug.com/938487
@decorators.Disabled('all')
def testPrompt(self, raw_input_mock, print_mock): def testPrompt(self, raw_input_mock, print_mock):
raw_input_mock.side_effect = ['', '42'] raw_input_mock.side_effect = ['', '42']
self.assertEqual(cli_helpers.Prompt( self.assertEqual(cli_helpers.Prompt(
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment