using explicit coverage2/3 in Makefile

This commit is contained in:
Yuming Zhu 2018-11-26 15:45:57 +08:00 committed by Mike McLean
parent 30c2e5f426
commit fa5ccf0eac
5 changed files with 21 additions and 28 deletions

View file

@ -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:

View file

@ -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

View file

@ -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

View file

@ -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)

View file

@ -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