468.3.8
by Andy Smith
merged from trunk |
1 |
#!/usr/bin/env python
|
1
by Jesse Andrews
initial commit |
2 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
|
114
by Devin Carlen
Updated licenses |
3 |
|
4 |
# Copyright 2010 United States Government as represented by the
|
|
3.1.9
by Vishvananda Ishaya
Removed trailing whitespace from header |
5 |
# Administrator of the National Aeronautics and Space Administration.
|
114
by Devin Carlen
Updated licenses |
6 |
# All Rights Reserved.
|
7 |
#
|
|
468.3.8
by Andy Smith
merged from trunk |
8 |
# Licensed under the Apache License, Version 2.0 (the "License");
|
9 |
# you may not use this file except in compliance with the License.
|
|
10 |
# You may obtain a copy of the License at
|
|
114
by Devin Carlen
Updated licenses |
11 |
#
|
468.3.8
by Andy Smith
merged from trunk |
12 |
# http://www.apache.org/licenses/LICENSE-2.0
|
1
by Jesse Andrews
initial commit |
13 |
#
|
14 |
# Unless required by applicable law or agreed to in writing, software
|
|
468.3.8
by Andy Smith
merged from trunk |
15 |
# distributed under the License is distributed on an "AS IS" BASIS,
|
16 |
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
17 |
# See the License for the specific language governing permissions and
|
|
18 |
# limitations under the License.
|
|
19 |
||
556.5.7
by Andy Smith
merge from upstream and fix small issues |
20 |
import gettext |
140.5.1
by Jay Pipes
Adds a flag to redirect STDERR when running run_tests.py. Defaults to a truncate-on-write logfile named run_tests.err.log. Adds ignore rule for generated errlog file. |
21 |
import os |
468.3.8
by Andy Smith
merged from trunk |
22 |
import unittest |
1
by Jesse Andrews
initial commit |
23 |
import sys |
24 |
||
468.3.8
by Andy Smith
merged from trunk |
25 |
from nose import config |
26 |
from nose import result |
|
27 |
from nose import core |
|
28 |
||
29 |
||
30 |
class NovaTestResult(result.TextTestResult): |
|
31 |
def __init__(self, *args, **kw): |
|
32 |
result.TextTestResult.__init__(self, *args, **kw) |
|
33 |
self._last_case = None |
|
34 |
||
35 |
def getDescription(self, test): |
|
36 |
return str(test) |
|
37 |
||
38 |
def startTest(self, test): |
|
39 |
unittest.TestResult.startTest(self, test) |
|
40 |
current_case = test.test.__class__.__name__ |
|
41 |
||
42 |
if self.showAll: |
|
43 |
if current_case != self._last_case: |
|
44 |
self.stream.writeln(current_case) |
|
45 |
self._last_case = current_case |
|
46 |
||
47 |
self.stream.write( |
|
48 |
' %s' % str(test.test._testMethodName).ljust(60)) |
|
49 |
self.stream.flush() |
|
50 |
||
51 |
||
52 |
class NovaTestRunner(core.TextTestRunner): |
|
53 |
def _makeResult(self): |
|
54 |
return NovaTestResult(self.stream, |
|
55 |
self.descriptions, |
|
56 |
self.verbosity, |
|
57 |
self.config) |
|
238.1.1
by andy
rather comprehensive style fixes |
58 |
|
140.5.1
by Jay Pipes
Adds a flag to redirect STDERR when running run_tests.py. Defaults to a truncate-on-write logfile named run_tests.err.log. Adds ignore rule for generated errlog file. |
59 |
|
1
by Jesse Andrews
initial commit |
60 |
if __name__ == '__main__': |
468.3.8
by Andy Smith
merged from trunk |
61 |
c = config.Config(stream=sys.stdout, |
62 |
env=os.environ, |
|
592.1.1
by Soren Hansen
Pass a PluginManager to nose.config.Config(). This lets us use plugins like coverage, xcoverage, etc. |
63 |
verbosity=3, |
64 |
plugins=core.DefaultPluginManager()) |
|
468.3.8
by Andy Smith
merged from trunk |
65 |
|
66 |
runner = NovaTestRunner(stream=c.stream, |
|
67 |
verbosity=c.verbosity, |
|
68 |
config=c) |
|
69 |
sys.exit(not core.run(config=c, testRunner=runner)) |