diff options
author | Michele Simionato <michele.simionato@gmail.com> | 2010-05-29 16:42:56 +0200 |
---|---|---|
committer | Michele Simionato <michele.simionato@gmail.com> | 2010-05-29 16:42:56 +0200 |
commit | b6e16e1287c71749a01c60c9385eed6598d0ba92 (patch) | |
tree | a99a37e41750f7eb7db52f6149e2468a86f67127 | |
parent | 224d123f0243fd22dbe3c76bd1a7c4716be2e986 (diff) | |
download | micheles-b6e16e1287c71749a01c60c9385eed6598d0ba92.tar.gz |
Small fixes to the clap tests
-rw-r--r-- | clap/example.py | 4 | ||||
-rw-r--r-- | clap/test_clap.py | 13 |
2 files changed, 15 insertions, 2 deletions
diff --git a/clap/example.py b/clap/example.py index ce813e0..69cc981 100644 --- a/clap/example.py +++ b/clap/example.py @@ -15,6 +15,6 @@ if __name__=='__main__': if not opt: OptionParser.exit() elif opt.delete_all: - print_(option.color, "Delete all files") + print_(opt.color, "Delete all files") elif opt.delete: - print_(option.color, "Delete the file %s" % option.delete) + print_(opt.color, "Delete the file %s" % opt.delete) diff --git a/clap/test_clap.py b/clap/test_clap.py index b8efbe9..8763ac6 100644 --- a/clap/test_clap.py +++ b/clap/test_clap.py @@ -1,3 +1,7 @@ +""" +The tests are runnable with nose, with py.test, or even as standalone script +""" + import sys from clap import OptionParser, ParsingError @@ -84,3 +88,12 @@ def test_p4(): arg = p4.parse_args(['--color=red']) assert arg, arg + +if __name__ == '__main__': + n = 0 + for name, test in globals().items(): + if name.startswith('test_'): + print 'Running', name + test() + n +=1 + print 'Executed %d tests OK' % n |