From f16b4db7ac74795bb059cc7db5503b598e93f508 Mon Sep 17 00:00:00 2001
From: Yuming Zhu <yzhu@redhat.com>
Date: Dec 03 2018 06:50:05 +0000
Subject: using explicit coverage2/3 in Makefile


---

diff --git a/Makefile b/Makefile
index 2db779b..93ba64c 100644
--- a/Makefile
+++ b/Makefile
@@ -65,22 +65,22 @@ 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
-	@echo Full coverage report in htmlcov/index.html
+	coverage2 report
+	coverage2 html
+	@echo Full coverage2 report in htmlcov/index.html
 
 test3:
 	coverage 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
-	@echo Full coverage report at file://${PWD}/htmlcov/index.html
+	@echo Full coverage3 report at file://${PWD}/htmlcov/index.html
 
 test-tarball:
 	@rm -rf .koji-$(VERSION)
diff --git a/tests/test_cli/data/list-commands-admin.txt b/tests/test_cli/data/list-commands-admin.txt
index 18290ba..1d5e1c1 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 <command> --help" for help about the options of a particular command
-Try "koji help <category>" 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} <command> --help" for help about the options of a particular command
+Try "{progname} help <category>" 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 98a901b..a33fab2 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 <command> --help" for help about the options of a particular command
-Try "koji help <category>" 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} <command> --help" for help about the options of a particular command
+Try "{progname} help <category>" 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 bc982ce..ef9b1f2 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 e01639e..cc53c12 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

