MCPcopy Index your code
hub / github.com/nodejs/node / Call

Method Call

deps/v8/tools/release/test_scripts.py:138–187  ·  view source on GitHub ↗
(self, name, *args, **kwargs)

Source from the content-addressed store, hash-verified

136 self._recipe = recipe
137
138 def Call(self, name, *args, **kwargs): # pragma: no cover
139 self._index += 1
140
141 try:
142 expected_call = self._recipe[self._index]
143 except IndexError:
144 raise NoRetryException("Calling %s %s" % (name, " ".join(args)))
145
146 if not isinstance(expected_call, dict):
147 raise NoRetryException("Found wrong expectation type for %s %s" %
148 (name, " ".join(args)))
149
150 if expected_call["name"] != name:
151 raise NoRetryException("Expected action: %s %s - Actual: %s" %
152 (expected_call["name"], expected_call["args"], name))
153
154 # Check if the given working directory matches the expected one.
155 if expected_call["cwd"] != kwargs.get("cwd"):
156 raise NoRetryException("Expected cwd: %s in %s %s - Actual: %s" %
157 (expected_call["cwd"],
158 expected_call["name"],
159 expected_call["args"],
160 kwargs.get("cwd")))
161
162 # The number of arguments in the expectation must match the actual
163 # arguments.
164 if len(args) > len(expected_call['args']):
165 raise NoRetryException("When calling %s with arguments, the "
166 "expectations must consist of at least as many arguments." %
167 name)
168
169 # Compare expected and actual arguments.
170 for (expected_arg, actual_arg) in zip(expected_call['args'], args):
171 if expected_arg != actual_arg:
172 raise NoRetryException("Expected: %s - Actual: %s" %
173 (expected_arg, actual_arg))
174
175 # The expected call contains an optional callback for checking the context
176 # at the time of the call.
177 if expected_call['cb']:
178 try:
179 expected_call['cb']()
180 except:
181 tb = traceback.format_exc()
182 raise NoRetryException("Caught exception from callback: %s" % tb)
183
184 # If the return value is an exception, raise it instead of returning.
185 if isinstance(expected_call['ret'], Exception):
186 raise expected_call['ret']
187 return expected_call['ret']
188
189 def AssertFinished(self): # pragma: no cover
190 if self._index < len(self._recipe) -1:

Callers 4

RunStepMethod · 0.45
CommandMethod · 0.45
ReadLineMethod · 0.45
ReadURLMethod · 0.45

Calls 4

NoRetryExceptionClass · 0.85
zipFunction · 0.85
getMethod · 0.65
joinMethod · 0.45

Tested by

no test coverage detected