OLD | NEW |
1 # Copyright (C) 2011 Google Inc. All rights reserved. | 1 # Copyright (C) 2011 Google Inc. All rights reserved. |
2 # | 2 # |
3 # Redistribution and use in source and binary forms, with or without | 3 # Redistribution and use in source and binary forms, with or without |
4 # modification, are permitted provided that the following conditions are | 4 # modification, are permitted provided that the following conditions are |
5 # met: | 5 # met: |
6 # | 6 # |
7 # * Redistributions of source code must retain the above copyright | 7 # * Redistributions of source code must retain the above copyright |
8 # notice, this list of conditions and the following disclaimer. | 8 # notice, this list of conditions and the following disclaimer. |
9 # * Redistributions in binary form must reproduce the above | 9 # * Redistributions in binary form must reproduce the above |
10 # copyright notice, this list of conditions and the following disclaimer | 10 # copyright notice, this list of conditions and the following disclaimer |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 return None | 53 return None |
54 return self.returncode | 54 return self.returncode |
55 | 55 |
56 def communicate(self, *_): | 56 def communicate(self, *_): |
57 return (self.stdout.getvalue(), self.stderr.getvalue()) | 57 return (self.stdout.getvalue(), self.stderr.getvalue()) |
58 | 58 |
59 | 59 |
60 class MockExecutive(object): | 60 class MockExecutive(object): |
61 PIPE = "MOCK PIPE" | 61 PIPE = "MOCK PIPE" |
62 STDOUT = "MOCK STDOUT" | 62 STDOUT = "MOCK STDOUT" |
| 63 DEVNULL = "MOCK_DEVNULL" |
63 | 64 |
64 @staticmethod | 65 @staticmethod |
65 def ignore_error(error): | 66 def ignore_error(error): |
66 pass | 67 pass |
67 | 68 |
68 def __init__(self, should_log=False, should_throw=False, | 69 def __init__(self, should_log=False, should_throw=False, |
69 output="MOCK output of child process", stderr='', | 70 output="MOCK output of child process", stderr='', |
70 exit_code=0, exception=None, run_command_fn=None): | 71 exit_code=0, exception=None, run_command_fn=None): |
71 self._should_log = should_log | 72 self._should_log = should_log |
72 self._should_throw = should_throw | 73 self._should_throw = should_throw |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
183 new_calls = self.calls[num_previous_calls:] | 184 new_calls = self.calls[num_previous_calls:] |
184 self.calls = self.calls[:num_previous_calls] | 185 self.calls = self.calls[:num_previous_calls] |
185 self.calls.append(new_calls) | 186 self.calls.append(new_calls) |
186 return command_outputs | 187 return command_outputs |
187 | 188 |
188 def map(self, thunk, arglist, processes=None): | 189 def map(self, thunk, arglist, processes=None): |
189 return map(thunk, arglist) | 190 return map(thunk, arglist) |
190 | 191 |
191 def process_dump(self): | 192 def process_dump(self): |
192 return [] | 193 return [] |
OLD | NEW |