| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright 2014 The Chromium Authors. All rights reserved. | 2 # Copyright 2014 The Chromium Authors. All rights reserved. |
| 3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
| 4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
| 5 | 5 |
| 6 | 6 |
| 7 """Unit tests for instrumentation.TestRunner.""" | 7 """Unit tests for instrumentation.TestRunner.""" |
| 8 | 8 |
| 9 # pylint: disable=W0212 | |
| 10 | |
| 11 import os | |
| 12 import sys | |
| 13 import unittest | 9 import unittest |
| 14 | 10 |
| 15 from pylib import constants | |
| 16 from pylib.base import base_test_result | 11 from pylib.base import base_test_result |
| 12 from pylib.constants import host_paths |
| 17 from pylib.instrumentation import instrumentation_test_instance | 13 from pylib.instrumentation import instrumentation_test_instance |
| 18 | 14 |
| 19 sys.path.append(os.path.join( | 15 with host_paths.SysPath(host_paths.PYMOCK_PATH): |
| 20 constants.DIR_SOURCE_ROOT, 'third_party', 'pymock')) | 16 import mock # pylint: disable=import-error |
| 21 import mock # pylint: disable=F0401 | |
| 22 | 17 |
| 23 | 18 |
| 24 class InstrumentationTestInstanceTest(unittest.TestCase): | 19 class InstrumentationTestInstanceTest(unittest.TestCase): |
| 25 | 20 |
| 26 def setUp(self): | 21 def setUp(self): |
| 27 options = mock.Mock() | 22 options = mock.Mock() |
| 28 options.tool = '' | 23 options.tool = '' |
| 29 | 24 |
| 30 def testGenerateTestResults_noStatus(self): | 25 def testGenerateTestResults_noStatus(self): |
| 31 results = instrumentation_test_instance.GenerateTestResults( | 26 results = instrumentation_test_instance.GenerateTestResults( |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 ] | 114 ] |
| 120 results = instrumentation_test_instance.GenerateTestResults( | 115 results = instrumentation_test_instance.GenerateTestResults( |
| 121 None, None, statuses, 0, 1000) | 116 None, None, statuses, 0, 1000) |
| 122 self.assertEqual(1, len(results)) | 117 self.assertEqual(1, len(results)) |
| 123 self.assertEqual(base_test_result.ResultType.FAIL, results[0].GetType()) | 118 self.assertEqual(base_test_result.ResultType.FAIL, results[0].GetType()) |
| 124 self.assertEqual(stacktrace, results[0].GetLog()) | 119 self.assertEqual(stacktrace, results[0].GetLog()) |
| 125 | 120 |
| 126 | 121 |
| 127 if __name__ == '__main__': | 122 if __name__ == '__main__': |
| 128 unittest.main(verbosity=2) | 123 unittest.main(verbosity=2) |
| OLD | NEW |