mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-08-27 10:07:19 +02:00
Test: Show total time on serial and parallel tests
Visible only when using run_all -l (or above)
This commit is contained in:
parent
e48fae387e
commit
157f191546
1 changed files with 7 additions and 3 deletions
10
test/run_all
10
test/run_all
|
@ -19,7 +19,8 @@ os.environ["TASKD_USE_PATH"] = "1"
|
||||||
TIMEOUT = .2
|
TIMEOUT = .2
|
||||||
|
|
||||||
|
|
||||||
def run_test(testqueue, outqueue):
|
def run_test(testqueue, outqueue, threadname):
|
||||||
|
start = time.time()
|
||||||
while True:
|
while True:
|
||||||
try:
|
try:
|
||||||
test = testqueue.get(block=True, timeout=TIMEOUT)
|
test = testqueue.get(block=True, timeout=TIMEOUT)
|
||||||
|
@ -43,6 +44,9 @@ def run_test(testqueue, outqueue):
|
||||||
|
|
||||||
testqueue.task_done()
|
testqueue.task_done()
|
||||||
|
|
||||||
|
log.warning("Finished %s thread after %s seconds",
|
||||||
|
threadname, round(time.time() - start, 3))
|
||||||
|
|
||||||
|
|
||||||
class TestRunner(object):
|
class TestRunner(object):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
|
@ -77,11 +81,11 @@ class TestRunner(object):
|
||||||
def _prepare_threads(self):
|
def _prepare_threads(self):
|
||||||
# Serial thread
|
# Serial thread
|
||||||
self.threads.append(
|
self.threads.append(
|
||||||
Thread(target=run_test, args=(self._serialq, self._outputq))
|
Thread(target=run_test, args=(self._serialq, self._outputq, "Serial"))
|
||||||
)
|
)
|
||||||
# Parallel threads
|
# Parallel threads
|
||||||
self.threads.extend([
|
self.threads.extend([
|
||||||
Thread(target=run_test, args=(self._parallelq, self._outputq))
|
Thread(target=run_test, args=(self._parallelq, self._outputq, "Parallel"))
|
||||||
for i in range(cpu_count())
|
for i in range(cpu_count())
|
||||||
])
|
])
|
||||||
log.info("Spawned %s threads to run tests", len(self.threads))
|
log.info("Spawned %s threads to run tests", len(self.threads))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue