Skip to content

Commit a051d3e

Browse files
committed
print time per test in verbose mode
1 parent b4c3bef commit a051d3e

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

graalpython/com.oracle.graal.python.test/src/graalpytest.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -152,18 +152,24 @@ def run_test(self, func):
152152
pass
153153
else:
154154
def do_run():
155+
start = time.monotonic()
155156
r = self.run_safely(func)
157+
end = time.monotonic() - start
156158
with print_lock:
157-
self.success() if r else self.failure()
159+
self.success(end) if r else self.failure(end)
158160
ThreadPool.start(do_run)
159161

160-
def success(self):
162+
def success(self, time):
161163
self.passed += 1
164+
if verbose:
165+
print("[%.3fs]" % time, end=" ")
162166
print(".", end="", flush=True)
163167

164-
def failure(self):
168+
def failure(self, time):
165169
self.failed += 1
166170
fail_msg = FAIL + BOLD + "F" + ENDC if verbose else "F"
171+
if verbose:
172+
print("[%.3fs]" % time, end=" ")
167173
print(fail_msg, end="", flush=True)
168174

169175
def assertIsInstance(self, value, cls):

0 commit comments

Comments
 (0)