summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuido Günther <agx@sigxcpu.org>2012-08-01 15:28:27 +0200
committerGuido Günther <agx@sigxcpu.org>2012-08-01 15:32:20 +0200
commit5961a4d3ae3217536a56876eee88ff5a8cdac4ba (patch)
tree7ab30c9b1910dc4f903d634e43ebfa79d2cde05d
parent56a8672699b9efbb3b26cd7fede15f29d7598ef0 (diff)
Test help output by importing the modules
so we get correct coverage information for the scripts
-rw-r--r--tests/01_test_help.py22
1 files changed, 13 insertions, 9 deletions
diff --git a/tests/01_test_help.py b/tests/01_test_help.py
index 1974c30..e30bc45 100644
--- a/tests/01_test_help.py
+++ b/tests/01_test_help.py
@@ -7,16 +7,20 @@ import unittest
class TestHelp(unittest.TestCase):
"""Test help output of gbp commands"""
- os.environ['PYTHONPATH'] = '.'
def testHelp(self):
- for prog in [ "buildpackage", "import-orig", "import-dsc", "dch" ]:
- ret = os.system("bin/git-%s --help >/dev/null" % prog)
- self.assertEqual(ret, 0)
-
- def testHelpGbp(self):
- for prog in [ "pull", "clone", "pq", "create-remote-repo" ]:
- ret = os.system("bin/gbp-%s --help >/dev/null" % prog)
- self.assertEqual(ret, 0)
+ for script in ['buildpackage',
+ 'clone',
+ 'create_remote_repo',
+ 'dch',
+ 'import_orig',
+ 'import_dsc',
+ 'pull',
+ 'pq']:
+ module = 'gbp.scripts.%s' % script
+ m = __import__(module, globals(), locals(), ['main'], -1)
+ self.assertRaises(SystemExit,
+ m.main,
+ ['doesnotmatter', '--help'])
# vim:et:ts=4:sw=4:et:sts=4:ai:set list listchars=tab\:»·,trail\:·: