diff options
| author | Rick Harris <rick.harris@rackspace.com> | 2011-06-15 00:08:19 +0000 |
|---|---|---|
| committer | Rick Harris <rick.harris@rackspace.com> | 2011-06-15 00:08:19 +0000 |
| commit | 3368a35ff9c06d74ec4b8fdb58d37771fc1a4f0d (patch) | |
| tree | a7107ebf2156501c3105696975e1aafd397fee9c | |
| parent | f46c9d7c96d591d1fffe2f45aee3e8d437e016bf (diff) | |
| download | nova-3368a35ff9c06d74ec4b8fdb58d37771fc1a4f0d.tar.gz nova-3368a35ff9c06d74ec4b8fdb58d37771fc1a4f0d.tar.xz nova-3368a35ff9c06d74ec4b8fdb58d37771fc1a4f0d.zip | |
Removing seconds unit
| -rw-r--r-- | run_tests.py | 20 | ||||
| -rwxr-xr-x | run_tests.sh | 2 |
2 files changed, 7 insertions, 15 deletions
diff --git a/run_tests.py b/run_tests.py index 3ecc146fd..c29a3da43 100644 --- a/run_tests.py +++ b/run_tests.py @@ -185,20 +185,13 @@ class _NullColorizer(object): self.stream.write(text) -def classify_test_speed(elapsed_time): +def get_elapsed_time_color(elapsed_time): if elapsed_time > 1.0: - return 'slow' + return 'red' elif elapsed_time > 0.25: - return 'sluggish' + return 'yellow' else: - return 'fast' - - -def get_elapsed_time_color(elapsed_time): - color_map = {'slow': 'red', 'sluggish': 'yellow', 'fast': 'green'} - slowness = classify_test_speed(elapsed_time) - color = color_map[slowness] - return color + return 'green' class NovaTestResult(result.TextTestResult): @@ -233,7 +226,6 @@ class NovaTestResult(result.TextTestResult): def _writeElapsedTime(self, test): color = get_elapsed_time_color(self.elapsed_time) self.colorizer.write(" %.2f" % self.elapsed_time, color) - self.stream.write(' secs') def _writeResult(self, test, long_result, color, short_result): if self.showAll: @@ -322,13 +314,13 @@ class NovaTestRunner(core.TextTestRunner): def _writeSlowTests(self, result_): # Pare out 'fast' tests slow_tests = [item for item in result_.slow_tests - if classify_test_speed(item[0]) != 'fast'] + if get_elapsed_time_color(item[0]) != 'green'] slow_total_time = sum(item[0] for item in slow_tests) self.stream.writeln("Slowest %i tests took %.2f secs:" % (len(slow_tests), slow_total_time)) for elapsed_time, test in sorted(slow_tests, reverse=True): - time_str = "%.2f secs" % elapsed_time + time_str = "%.2f" % elapsed_time self.stream.writeln(" %s %s" % (time_str.ljust(10), test)) def run(self, test): diff --git a/run_tests.sh b/run_tests.sh index 5fc406035..90af35579 100755 --- a/run_tests.sh +++ b/run_tests.sh @@ -10,7 +10,7 @@ function usage { echo " -f, --force Force a clean re-build of the virtual environment. Useful when dependencies have been added." echo " -p, --pep8 Just run pep8" echo " -h, --help Print this usage message" - echo " --show-elapsed Print elapsed time for tests along with slowest tests" + echo " --show-elapsed Print elapsed time in seconds for tests along with slowest tests" echo "" echo "Note: with no options specified, the script will try to run the tests in a virtual environment," echo " If no virtualenv is found, the script will ask if you would like to create one. If you " |
