OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright (c) 2011 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2011 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 """Unit tests for checkout.py.""" | 6 """Unit tests for checkout.py.""" |
7 | 7 |
8 from __future__ import with_statement | 8 from __future__ import with_statement |
9 import logging | 9 import logging |
10 import os | 10 import os |
11 import shutil | 11 import shutil |
12 import sys | 12 import sys |
13 import unittest | 13 import unittest |
14 from xml.etree import ElementTree | 14 from xml.etree import ElementTree |
15 | 15 |
16 ROOT_DIR = os.path.dirname(os.path.abspath(__file__)) | 16 ROOT_DIR = os.path.dirname(os.path.abspath(__file__)) |
17 sys.path.insert(0, os.path.dirname(ROOT_DIR)) | 17 sys.path.insert(0, os.path.dirname(ROOT_DIR)) |
18 | 18 |
| 19 from testing_support import fake_repos |
| 20 from testing_support.patches_data import GIT, RAW |
| 21 |
19 import checkout | 22 import checkout |
20 import patch | 23 import patch |
21 import subprocess2 | 24 import subprocess2 |
22 from tests import fake_repos | |
23 from tests.patches_data import GIT, RAW | |
24 | 25 |
25 | 26 |
26 # pass -v to enable it. | 27 # pass -v to enable it. |
27 DEBUGGING = False | 28 DEBUGGING = False |
28 | 29 |
29 # A patch that will fail to apply. | 30 # A patch that will fail to apply. |
30 BAD_PATCH = ''.join( | 31 BAD_PATCH = ''.join( |
31 [l for l in GIT.PATCH.splitlines(True) if l.strip() != 'e']) | 32 [l for l in GIT.PATCH.splitlines(True) if l.strip() != 'e']) |
32 | 33 |
33 | 34 |
(...skipping 543 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
577 if '-v' in sys.argv: | 578 if '-v' in sys.argv: |
578 DEBUGGING = True | 579 DEBUGGING = True |
579 logging.basicConfig( | 580 logging.basicConfig( |
580 level=logging.DEBUG, | 581 level=logging.DEBUG, |
581 format='%(levelname)5s %(filename)15s(%(lineno)3d): %(message)s') | 582 format='%(levelname)5s %(filename)15s(%(lineno)3d): %(message)s') |
582 else: | 583 else: |
583 logging.basicConfig( | 584 logging.basicConfig( |
584 level=logging.ERROR, | 585 level=logging.ERROR, |
585 format='%(levelname)5s %(filename)15s(%(lineno)3d): %(message)s') | 586 format='%(levelname)5s %(filename)15s(%(lineno)3d): %(message)s') |
586 unittest.main() | 587 unittest.main() |
OLD | NEW |