diff options
| author | James Westby <james.westby@linaro.org> | 2010-06-22 10:00:45 +0100 |
|---|---|---|
| committer | James Westby <james.westby@linaro.org> | 2010-06-22 10:00:45 +0100 |
| commit | 270f9891f392d43e3def190933b0d51f77fa2418 (patch) | |
| tree | 0fdc2cd33080e248fd4db2148195cfa9dd0f1574 /python | |
| parent | 96b349a1bde13a06fcc2926a62ac703d5d405553 (diff) | |
| download | subunit-git-270f9891f392d43e3def190933b0d51f77fa2418.tar.gz | |
Modify the usage message from subunit.run.
Diffstat (limited to 'python')
| -rwxr-xr-x | python/subunit/run.py | 30 |
1 files changed, 28 insertions, 2 deletions
diff --git a/python/subunit/run.py b/python/subunit/run.py index 60f2380..766a94a 100755 --- a/python/subunit/run.py +++ b/python/subunit/run.py @@ -23,7 +23,13 @@ import sys from subunit import TestProtocolClient, get_default_formatter -from testtools.run import TestProgram +from testtools.run import ( + BUFFEROUTPUT, + CATCHBREAK, + FAILFAST, + TestProgram, + USAGE_AS_MAIN, + ) class SubunitTestRunner(object): @@ -37,7 +43,27 @@ class SubunitTestRunner(object): return result +class SubunitTestProgram(TestProgram): + + USAGE = USAGE_AS_MAIN + + def usageExit(self, msg=None): + if msg: + print msg + usage = {'progName': self.progName, 'catchbreak': '', 'failfast': '', + 'buffer': ''} + if self.failfast != False: + usage['failfast'] = FAILFAST + if self.catchbreak != False: + usage['catchbreak'] = CATCHBREAK + if self.buffer != False: + usage['buffer'] = BUFFEROUTPUT + print self.USAGE % usage + print "The output will be in subunit format.\n" + sys.exit(2) + + if __name__ == '__main__': stream = get_default_formatter() runner = SubunitTestRunner(stream) - TestProgram(module=None, argv=sys.argv, testRunner=runner) + SubunitTestProgram(module=None, argv=sys.argv, testRunner=runner) |
