| |
@@ -316,9 +316,8 @@
|
| |
|
| |
@patch('time.time')
|
| |
@patch('time.sleep')
|
| |
- @patch('signal.sigtimedwait')
|
| |
@patch('signal.pause')
|
| |
- def test_BaseTaskHandler_wait_timeout(self, pause, sigtimedwait, sleep, time):
|
| |
+ def test_BaseTaskHandler_wait_timeout(self, pause, sleep, time):
|
| |
"""Tests timeout behavior in the wait function"""
|
| |
temp_path = self.get_tmp_dir_path('TaskTest')
|
| |
obj = TaskTest(95, 'some_method', ['random_arg'], None, None, temp_path)
|
| |
@@ -326,11 +325,18 @@
|
| |
obj.session = MagicMock()
|
| |
obj.session.host.taskWait.return_value = [[], [99, 100, 101]]
|
| |
time.side_effect = list(range(0, 4000, 60))
|
| |
+ if six.PY3:
|
| |
+ sigtimedwait = patch('signal.sigtimedwait').start()
|
| |
+
|
| |
try:
|
| |
obj.wait([99, 100, 101], timeout=3600)
|
| |
raise Exception('A GenericError was not raised.')
|
| |
except koji.GenericError as e:
|
| |
self.assertEqual(e.args[0][:24], 'Subtasks timed out after')
|
| |
+
|
| |
+ if six.PY3:
|
| |
+ sigtimedwait.stop()
|
| |
+
|
| |
obj.session.host.taskSetWait.assert_called_once_with(95, [99, 100, 101])
|
| |
obj.session.cancelTaskChildren.assert_called_once_with(95)
|
| |
obj.session.getTaskResult.assert_not_called()
|
| |
@@ -338,9 +344,8 @@
|
| |
|
| |
@patch('time.time')
|
| |
@patch('time.sleep')
|
| |
- @patch('signal.sigtimedwait')
|
| |
@patch('signal.pause')
|
| |
- def test_BaseTaskHandler_wait_avoid_timeout(self, pause, sigtimedwait, sleep, time):
|
| |
+ def test_BaseTaskHandler_wait_avoid_timeout(self, pause, sleep, time):
|
| |
"""Tests that timeout does not happen if tasks finish in time"""
|
| |
temp_path = self.get_tmp_dir_path('TaskTest')
|
| |
obj = TaskTest(95, 'some_method', ['random_arg'], None, None, temp_path)
|
| |
@@ -355,8 +360,15 @@
|
| |
# and then report all done
|
| |
taskWait_returns.append([[99, 100, 101], []])
|
| |
obj.session.host.taskWait.side_effect = taskWait_returns
|
| |
+
|
| |
+ if six.PY3:
|
| |
+ sigtimedwait = patch('signal.sigtimedwait').start()
|
| |
+
|
| |
obj.wait([99, 100, 101], timeout=3600)
|
| |
|
| |
+ if six.PY3:
|
| |
+ sigtimedwait.stop()
|
| |
+
|
| |
obj.session.host.taskSetWait.assert_called_once_with(95, [99, 100, 101])
|
| |
obj.session.cancelTaskChildren.assert_not_called()
|
| |
pause.assert_not_called()
|
| |
2 places in main code are changed
- py2 error in
koji.removeNonprintable
is fixed- FileNotFoundError is replaced by OSError
koji.util.rmtree
for py2fixes: #4248