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

Method run_test

tools/gyp/test_gyp.py:195–226  ·  view source on GitHub ↗
(self, test, fmt, i)

Source from the content-addressed store, hash-verified

193 self.took = time.time() - run_start
194
195 def run_test(self, test, fmt, i):
196 if self.isatty:
197 self.erase_current_line()
198
199 msg = self.fmt_str % (i, self.num_tests, fmt, test)
200 self.print_(msg)
201
202 start = time.time()
203 cmd = [sys.executable, test] + self.gyp_options
204 self.env["TESTGYP_FORMAT"] = fmt
205 proc = subprocess.Popen(
206 cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, env=self.env
207 )
208 proc.wait()
209 took = time.time() - start
210
211 stdout = proc.stdout.read().decode("utf8")
212 if proc.returncode == 2:
213 res = "skipped"
214 elif proc.returncode:
215 res = "failed"
216 self.failures.append(f"({test}) {fmt}")
217 else:
218 res = "passed"
219 res_msg = f" {res} {took:.3f}s"
220 self.print_(res_msg)
221
222 if stdout and not stdout.endswith(("PASSED\n", "NO RESULT\n")):
223 print()
224 print("\n".join(f" {line}" for line in stdout.splitlines()))
225 elif not self.isatty:
226 print()
227
228 def print_(self, msg):
229 print(msg, end="")

Callers 1

runMethod · 0.95

Calls 10

erase_current_lineMethod · 0.95
print_Method · 0.95
decodeMethod · 0.65
printFunction · 0.50
timeMethod · 0.45
waitMethod · 0.45
readMethod · 0.45
appendMethod · 0.45
joinMethod · 0.45
splitlinesMethod · 0.45

Tested by

no test coverage detected