diff --git a/Makefile b/Makefile index 3ad83543..f88379c6 100644 --- a/Makefile +++ b/Makefile @@ -69,21 +69,21 @@ git-clean: @git clean -d -q -x test: - coverage erase - PYTHONPATH=hub/.:plugins/hub/.:plugins/builder/.:plugins/cli/.:cli/.:www/lib coverage run \ + coverage2 erase + PYTHONPATH=hub/.:plugins/hub/.:plugins/builder/.:plugins/cli/.:cli/.:www/lib coverage2 run \ --source . /usr/bin/nosetests - coverage report - coverage html + coverage2 report + coverage2 html @echo Full coverage report in htmlcov/index.html test3: - coverage erase + coverage3 erase PYTHONPATH=hub/.:plugins/hub/.:plugins/builder/.:plugins/cli/.:cli/. coverage3 run \ --rcfile .coveragerc3 --source . \ - /usr/bin/nosetests-3 \ + /usr/bin/nosetests \ tests/test_lib tests/test_cli - coverage report --rcfile .coveragerc3 - coverage html --rcfile .coveragerc3 + coverage3 report --rcfile .coveragerc3 + coverage3 html --rcfile .coveragerc3 @echo Full coverage report at file://${PWD}/htmlcov/index.html test-tarball: diff --git a/tests/test_cli/data/list-commands-admin.txt b/tests/test_cli/data/list-commands-admin.txt index 18290ba9..1d5e1c14 100644 --- a/tests/test_cli/data/list-commands-admin.txt +++ b/tests/test_cli/data/list-commands-admin.txt @@ -62,8 +62,8 @@ admin commands: unlock-tag Unlock a tag write-signed-rpm Write signed RPMs to disk -Try "koji --help" for help about global options -Try "koji help" to get all available commands -Try "koji --help" for help about the options of a particular command -Try "koji help " to get commands under a particular category +Try "{progname} --help" for help about global options +Try "{progname} help" to get all available commands +Try "{progname} --help" for help about the options of a particular command +Try "{progname} help " to get commands under a particular category Available categories are: admin, all, bind, build, download, info, misc, monitor, search diff --git a/tests/test_cli/data/list-commands.txt b/tests/test_cli/data/list-commands.txt index 98a901b4..a33fab26 100644 --- a/tests/test_cli/data/list-commands.txt +++ b/tests/test_cli/data/list-commands.txt @@ -134,8 +134,8 @@ monitor commands: search commands: search Search the system -Try "koji --help" for help about global options -Try "koji help" to get all available commands -Try "koji --help" for help about the options of a particular command -Try "koji help " to get commands under a particular category +Try "{progname} --help" for help about global options +Try "{progname} help" to get all available commands +Try "{progname} --help" for help about the options of a particular command +Try "{progname} help " to get commands under a particular category Available categories are: admin, all, bind, build, download, info, misc, monitor, search diff --git a/tests/test_cli/test_list_commands.py b/tests/test_cli/test_list_commands.py index bc982ce3..ef9b1f2b 100644 --- a/tests/test_cli/test_list_commands.py +++ b/tests/test_cli/test_list_commands.py @@ -7,7 +7,7 @@ try: except ImportError: import unittest -from . import loadcli +from . import loadcli, utils cli = loadcli.cli @@ -31,13 +31,9 @@ class TestListCommands(unittest.TestCase): def test_list_commands(self, stdout): cli.list_commands() actual = stdout.getvalue() - if six.PY2: - actual = actual.replace('nosetests', 'koji') - else: - actual = actual.replace('nosetests-3', 'koji') filename = os.path.dirname(__file__) + '/data/list-commands.txt' with open(filename, 'rb') as f: - expected = f.read().decode('ascii') + expected = f.read().decode('ascii').format(progname=utils.PROGNAME) self.assertMultiLineEqual(actual, expected) @mock.patch('sys.stdout', new_callable=six.StringIO) @@ -47,11 +43,7 @@ class TestListCommands(unittest.TestCase): self.parser.parse_args.return_value = [options, arguments] cli.handle_help(self.options, self.session, self.args) actual = stdout.getvalue() - if six.PY2: - actual = actual.replace('nosetests', 'koji') - else: - actual = actual.replace('nosetests-3', 'koji') filename = os.path.dirname(__file__) + '/data/list-commands-admin.txt' with open(filename, 'rb') as f: - expected = f.read().decode('ascii') + expected = f.read().decode('ascii').format(progname=utils.PROGNAME) self.assertMultiLineEqual(actual, expected) diff --git a/tests/test_cli/utils.py b/tests/test_cli/utils.py index e01639ec..cc53c128 100644 --- a/tests/test_cli/utils.py +++ b/tests/test_cli/utils.py @@ -11,6 +11,7 @@ except ImportError: import unittest +PROGNAME = os.path.basename(sys.argv[0]) or 'koji' """ Classes @@ -40,7 +41,7 @@ class _dummy_(object): class CliTestCase(unittest.TestCase): # public attribute - progname = os.path.basename(sys.argv[0]) or 'koji' + progname = PROGNAME error_format = None STDOUT = sys.stdout STDERR = sys.stderr