OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2012 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 import os | 6 import os |
7 import StringIO | 7 import StringIO |
8 import sys | 8 import sys |
9 import threading | 9 import threading |
10 | 10 |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 else: | 93 else: |
94 with cv: | 94 with cv: |
95 cv.wait(timeout=output_block_for) | 95 cv.wait(timeout=output_block_for) |
96 order.append('unblock') | 96 order.append('unblock') |
97 return '' | 97 return '' |
98 def kid_kill(): | 98 def kid_kill(): |
99 with cv: | 99 with cv: |
100 order.append('killed') | 100 order.append('killed') |
101 cv.notify() | 101 cv.notify() |
102 if kill_raises: | 102 if kill_raises: |
103 raise OSError('somethign went wrong') | 103 raise OSError('something went wrong') |
104 | 104 |
105 kid = self.ProcessIdMock('') | 105 kid = self.ProcessIdMock('') |
106 kid.stdout.read = kid_stdout_read | 106 kid.stdout.read = kid_stdout_read |
107 kid.kill = kid_kill # pylint: disable=W0201 | 107 kid.kill = kid_kill # pylint: disable=W0201 |
108 cwd = 'bleh' | 108 cwd = 'bleh' |
109 args = ['ar', 'gs'] | 109 args = ['ar', 'gs'] |
110 gclient_utils.sys.stdout.write( | 110 gclient_utils.sys.stdout.write( |
111 '\n________ running \'ar gs\' in \'bleh\'\noutput') | 111 '\n________ running \'ar gs\' in \'bleh\'\noutput') |
112 os.getcwd() | 112 os.getcwd() |
113 subprocess2.Popen( | 113 subprocess2.Popen( |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
262 import unittest | 262 import unittest |
263 import logging | 263 import logging |
264 level = logging.DEBUG if '-v' in sys.argv else logging.FATAL | 264 level = logging.DEBUG if '-v' in sys.argv else logging.FATAL |
265 logging.basicConfig( | 265 logging.basicConfig( |
266 level=level, | 266 level=level, |
267 format='%(asctime).19s %(levelname)s %(filename)s:' | 267 format='%(asctime).19s %(levelname)s %(filename)s:' |
268 '%(lineno)s %(message)s') | 268 '%(lineno)s %(message)s') |
269 unittest.main() | 269 unittest.main() |
270 | 270 |
271 # vim: ts=2:sw=2:tw=80:et: | 271 # vim: ts=2:sw=2:tw=80:et: |
OLD | NEW |