Consistent wait/nowait in all related functions
Fixes: https://pagure.io/koji/issue/2522
This commit is contained in:
parent
d6694d0501
commit
56a2d86034
12 changed files with 72 additions and 55 deletions
|
|
@ -9,6 +9,7 @@ import unittest
|
|||
from koji_cli.commands import handle_chain_build
|
||||
from . import utils
|
||||
|
||||
|
||||
class TestChainBuild(utils.CliTestCase):
|
||||
# Show long diffs in error output...
|
||||
maxDiff = None
|
||||
|
|
@ -148,6 +149,7 @@ Task info: weburl/taskinfo?taskID=1
|
|||
|
||||
Options:
|
||||
-h, --help show this help message and exit
|
||||
--wait Wait on build, even if running in the background
|
||||
--nowait Don't wait on build
|
||||
--quiet Do not print the task information
|
||||
--background Run the build at a lower priority
|
||||
|
|
@ -655,12 +657,10 @@ Task info: weburl/taskinfo?taskID=1
|
|||
|
||||
@mock.patch('sys.stdout', new_callable=six.StringIO)
|
||||
@mock.patch('koji_cli.commands.activate_session')
|
||||
@mock.patch('koji_cli.commands._running_in_bg', return_value=False)
|
||||
@mock.patch('koji_cli.commands.watch_tasks', return_value=0)
|
||||
def test_handle_chain_build_nowait(
|
||||
self,
|
||||
watch_tasks_mock,
|
||||
running_in_bg_mock,
|
||||
activate_session_mock,
|
||||
stdout):
|
||||
target = 'target'
|
||||
|
|
@ -710,7 +710,6 @@ Task info: weburl/taskinfo?taskID=1
|
|||
self.session.getFullInheritance.assert_called_once_with(build_tag_id)
|
||||
self.session.chainBuild.assert_called_once_with(
|
||||
sources, target, priority=priority)
|
||||
running_in_bg_mock.assert_called_once()
|
||||
self.session.logout.assert_not_called()
|
||||
watch_tasks_mock.assert_not_called()
|
||||
self.assertIsNone(rv)
|
||||
|
|
|
|||
|
|
@ -301,6 +301,8 @@ Options:
|
|||
--multilib=CONFIG Include multilib packages in the repository using the
|
||||
given config file
|
||||
--noinherit Do not consider tag inheritance
|
||||
--wait Wait for the task to complete, even if running in the
|
||||
background
|
||||
--nowait Do not wait for the task to complete
|
||||
--skip-missing-signatures
|
||||
Skip RPMs not signed with the desired key(s)
|
||||
|
|
|
|||
|
|
@ -342,7 +342,9 @@ Options:
|
|||
--logs Also download build logs
|
||||
--topurl=URL URL under which Koji files are accessible
|
||||
--noprogress Do not display progress meter
|
||||
--wait Wait for running tasks to finish
|
||||
--wait Wait for running tasks to finish, even if running in the
|
||||
background
|
||||
--nowait Do not wait for running tasks to finish
|
||||
-q, --quiet Suppress output
|
||||
""" % progname
|
||||
self.assertMultiLineEqual(actual, expected)
|
||||
|
|
|
|||
|
|
@ -147,7 +147,7 @@ class TestBuildImageIndirection(utils.CliTestCase):
|
|||
expected = "Missing the following required options: "
|
||||
expected += "--" + r.replace('_', '-') + "\n"
|
||||
with self.assertRaises(koji.GenericError) as cm:
|
||||
with mock.patch('sys.stdout', new_callable=six.StringIO) as stdout:
|
||||
with mock.patch('sys.stdout', new_callable=six.StringIO) as stdout:
|
||||
_build_image_indirection(
|
||||
self.options, self.task_opts, self.session, [])
|
||||
self.assert_console_message(stdout, expected)
|
||||
|
|
@ -255,6 +255,7 @@ Options:
|
|||
--scratch Create a scratch image
|
||||
--wait Wait on the image creation, even if running in the
|
||||
background
|
||||
--nowait Do not wait on the image creation
|
||||
--noprogress Do not display progress of the upload
|
||||
""" % (self.progname, self.progname))
|
||||
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ from . import utils
|
|||
|
||||
EMPTY_BUILD_OPTS = {
|
||||
'specfile': None,
|
||||
'nowait': None,
|
||||
'wait': None,
|
||||
'patches': None,
|
||||
'envs': [],
|
||||
'scratch': None,
|
||||
|
|
@ -215,6 +215,7 @@ Options:
|
|||
wrapper RPMs
|
||||
--skip-tag Do not attempt to tag package
|
||||
--scratch Perform a scratch build
|
||||
--wait Wait on build, even if running in the background
|
||||
--nowait Don't wait on build
|
||||
--quiet Do not print the task information
|
||||
--background Run the build at a lower priority
|
||||
|
|
@ -726,12 +727,10 @@ Task info: weburl/taskinfo?taskID=1
|
|||
@mock.patch('koji_cli.commands.activate_session')
|
||||
@mock.patch('koji.util.parse_maven_param')
|
||||
@mock.patch('koji.util.maven_opts', return_value={})
|
||||
@mock.patch('koji_cli.commands._running_in_bg', return_value=False)
|
||||
@mock.patch('koji_cli.commands.watch_tasks', return_value=0)
|
||||
def test_handle_maven_build_nowait(
|
||||
self,
|
||||
watch_tasks_mock,
|
||||
running_in_bg_mock,
|
||||
maven_opts_mock,
|
||||
parse_maven_param_mock,
|
||||
activate_session_mock,
|
||||
|
|
@ -745,7 +744,7 @@ Task info: weburl/taskinfo?taskID=1
|
|||
task_id = 1
|
||||
args = ['--nowait', target, source]
|
||||
build_opts = EMPTY_BUILD_OPTS.copy()
|
||||
build_opts['nowait'] = True
|
||||
build_opts['wait'] = False
|
||||
opts = {}
|
||||
priority = None
|
||||
scratch = None
|
||||
|
|
@ -770,7 +769,6 @@ Task info: weburl/taskinfo?taskID=1
|
|||
maven_opts_mock.assert_called_once_with(build_opts, scratch=scratch)
|
||||
self.session.mavenBuild.assert_called_once_with(
|
||||
source, target, opts, priority=priority)
|
||||
running_in_bg_mock.assert_called_once()
|
||||
self.session.logout.assert_not_called()
|
||||
watch_tasks_mock.assert_not_called()
|
||||
self.assertIsNone(rv)
|
||||
|
|
|
|||
|
|
@ -181,6 +181,7 @@ Options:
|
|||
--scratch Perform scratch builds
|
||||
--debug Run Maven build in debug mode
|
||||
--force Force rebuilds of all packages
|
||||
--wait Wait on build, even if running in the background
|
||||
--nowait Don't wait on build
|
||||
--background Run the build at a lower priority
|
||||
""" % (self.progname))
|
||||
|
|
|
|||
|
|
@ -154,7 +154,8 @@ class TestMoveBuild(utils.CliTestCase):
|
|||
Options:
|
||||
-h, --help show this help message and exit
|
||||
--force force operation
|
||||
--nowait do not wait on tasks
|
||||
--wait Wait on tasks, even if running in the background
|
||||
--nowait Do not wait on tasks
|
||||
--all move all instances of a package, <pkg>'s are package names
|
||||
""" % self.progname)
|
||||
|
||||
|
|
|
|||
|
|
@ -177,6 +177,8 @@ class TestRegenRepo(utils.CliTestCase):
|
|||
Options:
|
||||
-h, --help show this help message and exit
|
||||
--target Interpret the argument as a build target name
|
||||
--wait Wait on for regen to finish, even if running in the
|
||||
background
|
||||
--nowait Don't wait on for regen to finish
|
||||
--debuginfo Include debuginfo rpms in repo
|
||||
--source, --src Include source rpms in each of repos
|
||||
|
|
|
|||
|
|
@ -126,10 +126,12 @@ Log Files:
|
|||
|
||||
Options:
|
||||
-h, --help show this help message and exit
|
||||
--wait Wait on task, even if running in the background
|
||||
--nowait Don't wait on task
|
||||
--nowatch An alias for --nowait
|
||||
--quiet Do not print the task information
|
||||
""" % self.progname)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
|
|
|
|||
|
|
@ -73,7 +73,8 @@ class TestTagBuild(utils.CliTestCase):
|
|||
def test_handle_tag_build_argument_error(self):
|
||||
"""Test handle_tag_build function with error argument"""
|
||||
expected = self.format_error_message(
|
||||
"This command takes at least two arguments: a tag name/ID and one or more package n-v-r's")
|
||||
"This command takes at least two arguments: a tag name/ID and one or "
|
||||
"more package n-v-r's")
|
||||
for arg in [[], ['tag']]:
|
||||
self.assert_system_exit(
|
||||
handle_tag_build,
|
||||
|
|
@ -92,6 +93,7 @@ class TestTagBuild(utils.CliTestCase):
|
|||
Options:
|
||||
-h, --help show this help message and exit
|
||||
--force force operation
|
||||
--wait Wait on task, even if running in the background
|
||||
--nowait Do not wait on task
|
||||
""" % self.progname)
|
||||
|
||||
|
|
|
|||
|
|
@ -205,7 +205,8 @@ class TestWrapperRpm(utils.CliTestCase):
|
|||
|
||||
# Run it and check immediate output
|
||||
expected = self.format_error_message(
|
||||
"You must provide a build target, a build ID or NVR, and a SCM URL to a specfile fragment")
|
||||
"You must provide a build target, a build ID or NVR, and a SCM URL to "
|
||||
"a specfile fragment")
|
||||
self.assert_system_exit(
|
||||
handle_wrapper_rpm,
|
||||
options,
|
||||
|
|
@ -233,6 +234,7 @@ Options:
|
|||
Get build parameters from this section of the .ini
|
||||
--skip-tag If creating a new build, don't tag it
|
||||
--scratch Perform a scratch build
|
||||
--wait Wait on build, even if running in the background
|
||||
--nowait Don't wait on build
|
||||
--background Run the build at a lower priority
|
||||
""" % self.progname)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue