def test_exception(self): def exception_raising_lint(host, options): # pylint: disable=unused-argument assert False lint_test_expectations.lint = exception_raising_lint res = lint_test_expectations.main([], self.stderr, host=MockHost()) self.assertEqual(res, exit_codes.EXCEPTIONAL_EXIT_STATUS)
def test_interrupt(self): def interrupting_lint(host, options): # pylint: disable=unused-argument raise KeyboardInterrupt lint_test_expectations.lint = interrupting_lint res = lint_test_expectations.main([], self.stderr, host=MockHost()) self.assertEqual(res, exit_codes.INTERRUPTED_EXIT_STATUS)
def test_success_with_warning(self): lint_test_expectations.lint = lambda host, options: ([], ['test warning']) res = lint_test_expectations.main(['--platform', 'test'], self.stderr) self.assertEqual('Lint succeeded with warnings.', self.stderr.getvalue().strip()) self.assertEqual(res, 2)
def test_failure_with_warning(self): lint_test_expectations.lint = lambda host, options: (['test failure'], ['test warning']) res = lint_test_expectations.main(['--platform', 'test'], self.stderr) self.assertEqual('Lint failed.', self.stderr.getvalue().strip()) self.assertEqual(res, 1)
def test_success(self): lint_test_expectations.lint = lambda host, options: ([], []) res = lint_test_expectations.main(['--platform', 'test'], self.stderr) self.assertEqual('Lint succeeded.', self.stderr.getvalue().strip()) self.assertEqual(res, 0)
#!/usr/bin/env vpython # Copyright 2018 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. import sys from blinkpy.common import version_check # pylint: disable=unused-import from blinkpy.web_tests.lint_test_expectations import main if __name__ == '__main__': sys.exit(main(sys.argv[1:], sys.stderr))