| |
@@ -3235,23 +3235,28 @@
|
| |
mock_build_api = None
|
| |
|
| |
with patch('koji_cli.lib.watch_tasks') as watch_tasks:
|
| |
- with patch('sys.argv', new=cli_cmd):
|
| |
- cli = self.new_cli(cfg=config_file)
|
| |
- if sub_command == 'build':
|
| |
- mock_build_api = session.build
|
| |
- cli.build()
|
| |
- elif sub_command == 'scratch-build':
|
| |
- mock_build_api = session.build
|
| |
- cli.scratch_build()
|
| |
- elif sub_command == 'chain-build':
|
| |
- mock_build_api = session.chainBuild
|
| |
- cli.chainbuild()
|
| |
-
|
| |
- if '--nowait' in cli_cmd:
|
| |
- watch_tasks.assert_not_called()
|
| |
- else:
|
| |
- watch_tasks.assert_called_once_with(
|
| |
- session, [mock_build_api.return_value])
|
| |
+ with patch('pyrpkg.utils.make_koji_watch_tasks_handler') as mock_ki:
|
| |
+ with patch('sys.argv', new=cli_cmd):
|
| |
+ cli = self.new_cli(cfg=config_file)
|
| |
+ if sub_command == 'build':
|
| |
+ mock_build_api = session.build
|
| |
+ cli.build()
|
| |
+ elif sub_command == 'scratch-build':
|
| |
+ mock_build_api = session.build
|
| |
+ cli.scratch_build()
|
| |
+ elif sub_command == 'chain-build':
|
| |
+ mock_build_api = session.chainBuild
|
| |
+ cli.chainbuild()
|
| |
+
|
| |
+ if '--nowait' in cli_cmd:
|
| |
+ watch_tasks.assert_not_called()
|
| |
+ else:
|
| |
+ watch_tasks.assert_called_once_with(
|
| |
+ session,
|
| |
+ [mock_build_api.return_value],
|
| |
+ ki_handler=mock_ki.return_value
|
| |
+ )
|
| |
+ self.assertEqual(mock_ki.call_args, (("koji",),))
|
| |
|
| |
mock_build_api.assert_called_once()
|
| |
|
| |
Output text during rhpkg/fedpkg build process states that there is a 'watch_task' subcommand. When 'koji_cli' library is imported in rhpkg/fedpkg tool, it shows that command is named 'rhpkg/fedpkg watch_task' instead of 'brew/koji watch_task'. Custom handler replaces the internal one inside koji_cli library.
Additional fix in rhpkg is needed after this change is released.
Relates: rhbz#1570921
Relates: COMPOSE-2809
Signed-off-by: Ondrej Nosek onosek@redhat.com