summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Chauvat <nicolas.chauvat@logilab.fr>2007-04-08 21:31:33 +0200
committerNicolas Chauvat <nicolas.chauvat@logilab.fr>2007-04-08 21:31:33 +0200
commitb72745bc442e017d6b9d107f1d15e2106e9662aa (patch)
treec8a50e95283ea9aae90ea44606f82851ef02476f
parent0ef577e1d0f05ee1e29e328f232867828caf9190 (diff)
downloadlogilab-common-b72745bc442e017d6b9d107f1d15e2106e9662aa.tar.gz
add examples to --help
-rw-r--r--pytest.py19
1 files changed, 14 insertions, 5 deletions
diff --git a/pytest.py b/pytest.py
index 6df927c..53e97e1 100644
--- a/pytest.py
+++ b/pytest.py
@@ -1,4 +1,14 @@
-"""%prog [OPTIONS] [testfile [testpattern]]"""
+"""%prog [OPTIONS] [testfile [testpattern]]
+
+examples:
+
+pytest path/to/mytests.py
+pytest path/to/mytests.py TheseTests
+pytest path/to/mytests.py TheseTests.test_thisone
+
+pytest one (will run both test_thisone and test_thatone)
+pytest path/to/mytests.py -s not (will skip test_notthisone)
+"""
import os, sys
import os.path as osp
@@ -141,9 +151,8 @@ def testfile(filename, batchmode=False):
def parseargs():
- """builds an option parser
-
- This funcion also rebuilds a sys.argv usable by unittest_main
+ """Parse the command line and return (options processed), (options to pass to
+ unittest_main()), (explicitfile or None).
"""
from optparse import OptionParser
parser = OptionParser(usage=__doc__)
@@ -200,7 +209,7 @@ def parseargs():
filenames = [arg for arg in args if arg.endswith('.py')]
if filenames:
if len(filenames) > 1:
- parser.error("only one filename is accetable")
+ parser.error("only one filename is acceptable")
explicitfile = filenames[0]
args.remove(explicitfile)
else: