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 gclient.py. | 6 """Unit tests for gclient.py. |
7 | 7 |
8 See gclient_smoketest.py for integration tests. | 8 See gclient_smoketest.py for integration tests. |
9 """ | 9 """ |
10 | 10 |
11 from __future__ import with_statement | 11 from __future__ import with_statement |
12 import Queue | 12 import Queue |
13 import logging | 13 import logging |
14 import os | 14 import os |
15 import sys | 15 import sys |
16 import unittest | 16 import unittest |
17 | 17 |
18 BASE_DIR = os.path.dirname(os.path.abspath(__file__)) | 18 sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) |
19 sys.path.insert(0, os.path.dirname(BASE_DIR)) | |
20 | 19 |
21 import gclient | 20 import gclient |
22 import gclient_utils | 21 import gclient_utils |
23 from tests import trial_dir | 22 from tests import trial_dir |
24 | 23 |
25 | 24 |
26 def write(filename, content): | 25 def write(filename, content): |
27 """Writes the content of a file and create the directories as needed.""" | 26 """Writes the content of a file and create the directories as needed.""" |
28 filename = os.path.abspath(filename) | 27 filename = os.path.abspath(filename) |
29 dirname = os.path.dirname(filename) | 28 dirname = os.path.dirname(filename) |
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
252 sys.stdout = gclient_utils.MakeFileAutoFlush(sys.stdout) | 251 sys.stdout = gclient_utils.MakeFileAutoFlush(sys.stdout) |
253 sys.stdout = gclient_utils.MakeFileAnnotated(sys.stdout, include_zero=True) | 252 sys.stdout = gclient_utils.MakeFileAnnotated(sys.stdout, include_zero=True) |
254 sys.stderr = gclient_utils.MakeFileAutoFlush(sys.stderr) | 253 sys.stderr = gclient_utils.MakeFileAutoFlush(sys.stderr) |
255 sys.stderr = gclient_utils.MakeFileAnnotated(sys.stderr, include_zero=True) | 254 sys.stderr = gclient_utils.MakeFileAnnotated(sys.stderr, include_zero=True) |
256 logging.basicConfig( | 255 logging.basicConfig( |
257 level=[logging.ERROR, logging.WARNING, logging.INFO, logging.DEBUG][ | 256 level=[logging.ERROR, logging.WARNING, logging.INFO, logging.DEBUG][ |
258 min(sys.argv.count('-v'), 3)], | 257 min(sys.argv.count('-v'), 3)], |
259 format='%(relativeCreated)4d %(levelname)5s %(module)13s(' | 258 format='%(relativeCreated)4d %(levelname)5s %(module)13s(' |
260 '%(lineno)d) %(message)s') | 259 '%(lineno)d) %(message)s') |
261 unittest.main() | 260 unittest.main() |
OLD | NEW |