OLD | NEW |
1 #!/usr/bin/python | 1 #!/usr/bin/python |
2 # Copyright 2015 The Chromium Authors. All rights reserved. | 2 # Copyright 2015 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 # pylint: disable=protected-access | 6 # pylint: disable=protected-access |
7 | 7 |
8 import os | |
9 import sys | |
10 import unittest | 8 import unittest |
11 from xml.etree import ElementTree | 9 from xml.etree import ElementTree |
12 | 10 |
13 import emma_coverage_stats | 11 import emma_coverage_stats |
14 from pylib import constants | 12 from pylib.constants import host_paths |
15 | 13 |
16 sys.path.append(os.path.join( | 14 with host_paths.SysPath(host_paths.PYMOCK_PATH): |
17 constants.DIR_SOURCE_ROOT, 'third_party', 'pymock')) | 15 import mock # pylint: disable=import-error |
18 import mock # pylint: disable=import-error | |
19 | 16 |
20 EMPTY_COVERAGE_STATS_DICT = { | 17 EMPTY_COVERAGE_STATS_DICT = { |
21 'files': {}, | 18 'files': {}, |
22 'patch': { | 19 'patch': { |
23 'incremental': { | 20 'incremental': { |
24 'covered': 0, 'total': 0 | 21 'covered': 0, 'total': 0 |
25 } | 22 } |
26 } | 23 } |
27 } | 24 } |
28 | 25 |
(...skipping 528 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
557 mock_open = mock.mock_open() | 554 mock_open = mock.mock_open() |
558 mock_open.side_effect = [mock.mock_open(read_data=side_effect).return_value | 555 mock_open.side_effect = [mock.mock_open(read_data=side_effect).return_value |
559 for side_effect in side_effects] | 556 for side_effect in side_effects] |
560 with mock.patch('__builtin__.open', mock_open): | 557 with mock.patch('__builtin__.open', mock_open): |
561 return func(**kwargs), mock_open | 558 return func(**kwargs), mock_open |
562 | 559 |
563 | 560 |
564 if __name__ == '__main__': | 561 if __name__ == '__main__': |
565 # Suppress logging messages. | 562 # Suppress logging messages. |
566 unittest.main(buffer=True) | 563 unittest.main(buffer=True) |
OLD | NEW |