From 5961a4d3ae3217536a56876eee88ff5a8cdac4ba Mon Sep 17 00:00:00 2001 From: Guido Günther Date: Wed, 1 Aug 2012 15:28:27 +0200 Subject: Test help output by importing the modules so we get correct coverage information for the scripts --- tests/01_test_help.py | 22 +++++++++++++--------- 1 file 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\:·: -- cgit v1.2.3