Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5)

Side by Side Diff: third_party/WebKit/Tools/Scripts/webkitpy/common/system/executive_mock.py

Issue 2248653002: Revert of Fix pylint warnings in webkitpy/common/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Manual Revert (Patch Set 1 causes patch failure in read_checksum_from_png_unittest.py) Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 _log.info("MOCK running_pids: %s", running_pids) 87 _log.info("MOCK running_pids: %s", running_pids)
88 return running_pids 88 return running_pids
89 89
90 def command_for_printing(self, args): 90 def command_for_printing(self, args):
91 string_args = map(unicode, args) 91 string_args = map(unicode, args)
92 return " ".join(string_args) 92 return " ".join(string_args)
93 93
94 def run_command(self, 94 def run_command(self,
95 args, 95 args,
96 cwd=None, 96 cwd=None,
97 input_func=None, 97 input=None,
98 error_handler=None, 98 error_handler=None,
99 return_exit_code=False, 99 return_exit_code=False,
100 return_stderr=True, 100 return_stderr=True,
101 decode_output=False, 101 decode_output=False,
102 env=None, 102 env=None,
103 debug_logging=False): 103 debug_logging=False):
104 104
105 self.calls.append(args) 105 self.calls.append(args)
106 106
107 assert isinstance(args, list) or isinstance(args, tuple) 107 assert isinstance(args, list) or isinstance(args, tuple)
108 if self._should_log: 108 if self._should_log:
109 env_string = "" 109 env_string = ""
110 if env: 110 if env:
111 env_string = ", env=%s" % env 111 env_string = ", env=%s" % env
112 input_string = "" 112 input_string = ""
113 if input_func: 113 if input:
114 input_string = ", input=%s" % input_func 114 input_string = ", input=%s" % input
115 _log.info("MOCK run_command: %s, cwd=%s%s%s", args, cwd, env_string, input_string) 115 _log.info("MOCK run_command: %s, cwd=%s%s%s", args, cwd, env_string, input_string)
116 output = "MOCK output of child process" 116 output = "MOCK output of child process"
117 117
118 if self._should_throw_when_run.intersection(args): 118 if self._should_throw_when_run.intersection(args):
119 raise ScriptError("Exception for %s" % args, output="MOCK command ou tput") 119 raise ScriptError("Exception for %s" % args, output="MOCK command ou tput")
120 120
121 if self._should_throw: 121 if self._should_throw:
122 raise ScriptError("MOCK ScriptError", output=output) 122 raise ScriptError("MOCK ScriptError", output=output)
123 123
124 if return_exit_code and self._should_return_zero_when_run.intersection(a rgs): 124 if return_exit_code and self._should_return_zero_when_run.intersection(a rgs):
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 self._output = output 183 self._output = output
184 self._stderr = stderr 184 self._stderr = stderr
185 self._exit_code = exit_code 185 self._exit_code = exit_code
186 self._exception = exception 186 self._exception = exception
187 self._run_command_fn = run_command_fn 187 self._run_command_fn = run_command_fn
188 self.calls = [] 188 self.calls = []
189 189
190 def run_command(self, 190 def run_command(self,
191 args, 191 args,
192 cwd=None, 192 cwd=None,
193 input_func=None, 193 input=None,
194 error_handler=None, 194 error_handler=None,
195 return_exit_code=False, 195 return_exit_code=False,
196 return_stderr=True, 196 return_stderr=True,
197 decode_output=False, 197 decode_output=False,
198 env=None, 198 env=None,
199 debug_logging=False): 199 debug_logging=False):
200 self.calls.append(args) 200 self.calls.append(args)
201 assert isinstance(args, list) or isinstance(args, tuple) 201 assert isinstance(args, list) or isinstance(args, tuple)
202 assert all(isinstance(arg, basestring) for arg in args) 202 assert all(isinstance(arg, basestring) for arg in args)
203 if self._exception: 203 if self._exception:
204 raise self._exception # pylint: disable=E0702 204 raise self._exception # pylint: disable=E0702
205 if self._run_command_fn: 205 if self._run_command_fn:
206 return self._run_command_fn(args) 206 return self._run_command_fn(args)
207 if return_exit_code: 207 if return_exit_code:
208 return self._exit_code 208 return self._exit_code
209 if self._exit_code and error_handler: 209 if self._exit_code and error_handler:
210 script_error = ScriptError(script_args=args, exit_code=self._exit_co de, output=self._output) 210 script_error = ScriptError(script_args=args, exit_code=self._exit_co de, output=self._output)
211 error_handler(script_error) 211 error_handler(script_error)
212 if return_stderr: 212 if return_stderr:
213 return self._output + self._stderr 213 return self._output + self._stderr
214 return self._output 214 return self._output
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698