[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [stem/master] Note runtime of static checks
commit 225b31325a4677f5c4f55f5adc6a9a4950913b7b
Author: Damian Johnson <atagar@xxxxxxxxxxxxxx>
Date: Wed Feb 15 10:29:02 2017 -0800
Note runtime of static checks
These are pretty lengthy operations so good to know how long they take.
---
run_tests.py | 2 ++
test/util.py | 7 ++++++-
2 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/run_tests.py b/run_tests.py
index 501cbfa..39c44cb 100755
--- a/run_tests.py
+++ b/run_tests.py
@@ -78,6 +78,7 @@ PYFLAKES_TASK = Task(
args = (SRC_PATHS,),
is_required = False,
print_result = False,
+ print_runtime = True,
)
PYCODESTYLE_TASK = Task(
@@ -86,6 +87,7 @@ PYCODESTYLE_TASK = Task(
args = (SRC_PATHS, True, True, True),
is_required = False,
print_result = False,
+ print_runtime = True,
)
if stem.prereq._is_python_26():
diff --git a/test/util.py b/test/util.py
index 482677e..1b50369 100644
--- a/test/util.py
+++ b/test/util.py
@@ -32,6 +32,7 @@ Tasks are...
import re
import os
import sys
+import time
import stem
import stem.prereq
@@ -350,7 +351,7 @@ class Task(object):
message or list of strings for its results.
"""
- def __init__(self, label, runner, args = None, is_required = True, print_result = True):
+ def __init__(self, label, runner, args = None, is_required = True, print_result = True, print_runtime = False):
super(Task, self).__init__()
self.label = label
@@ -358,12 +359,14 @@ class Task(object):
self.args = args
self.is_required = is_required
self.print_result = print_result
+ self.print_runtime = print_runtime
self.error = None
self.is_successful = False
self.result = None
def run(self):
+ start_time = time.time()
println(' %s...' % self.label, STATUS, NO_NL)
padding = 50 - len(self.label)
@@ -380,6 +383,8 @@ class Task(object):
if self.print_result and isinstance(self.result, str):
output_msg = self.result
+ elif self.print_runtime:
+ output_msg += ' (%0.1fs)' % (time.time() - start_time)
println(output_msg, STATUS)
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits