1 |
At the moment, trying to do `./runtests.h -h` just produces an ugly and |
2 |
indecipherable traceback. Make it a bit more friendly. |
3 |
|
4 |
Signed-off-by: Mike Frysinger <vapier@g.o> |
5 |
--- |
6 |
pym/portage/tests/__init__.py | 9 +++++++-- |
7 |
1 files changed, 7 insertions(+), 2 deletions(-) |
8 |
|
9 |
diff --git a/pym/portage/tests/__init__.py b/pym/portage/tests/__init__.py |
10 |
index 7f1ed3f..07be2f6 100644 |
11 |
--- a/pym/portage/tests/__init__.py |
12 |
+++ b/pym/portage/tests/__init__.py |
13 |
@@ -5,6 +5,7 @@ |
14 |
import sys |
15 |
import time |
16 |
import unittest |
17 |
+from optparse import OptionParser, OptionValueError |
18 |
|
19 |
try: |
20 |
from unittest.runner import _TextTestResult # new in python-2.7 |
21 |
@@ -23,8 +24,12 @@ def main(): |
22 |
basedir = os.path.dirname(os.path.realpath(__file__)) |
23 |
testDirs = [] |
24 |
|
25 |
- if len(sys.argv) > 1: |
26 |
- suite.addTests(getTestFromCommandLine(sys.argv[1:], basedir)) |
27 |
+ usage = "usage: %s [options] [tests to run]" % sys.argv[0] |
28 |
+ parser = OptionParser(usage=usage) |
29 |
+ (options, args) = parser.parse_args(args=sys.argv) |
30 |
+ |
31 |
+ if len(args) > 1: |
32 |
+ suite.addTests(getTestFromCommandLine(args[1:], basedir)) |
33 |
return TextTestRunner(verbosity=2).run(suite) |
34 |
|
35 |
# the os.walk help mentions relative paths as being quirky |
36 |
-- |
37 |
1.7.6.1 |