Use unittest2 for rhel6 compatibility
Fixes: https://pagure.io/koji/issue/830
This commit is contained in:
parent
c633188bec
commit
c68396c059
162 changed files with 1152 additions and 537 deletions
|
|
@ -3,7 +3,10 @@ import mock
|
|||
import os
|
||||
import six
|
||||
import sys
|
||||
import unittest
|
||||
try:
|
||||
import unittest2 as unittest
|
||||
except ImportError:
|
||||
import unittest
|
||||
|
||||
from koji_cli.commands import handle_build, _progress_callback
|
||||
|
||||
|
|
@ -162,7 +165,10 @@ Task info: weburl/taskinfo?taskID=1
|
|||
self.session.build.assert_not_called()
|
||||
self.session.logout.assert_not_called()
|
||||
watch_tasks_mock.assert_not_called()
|
||||
self.assertEqual(cm.exception.code, 2)
|
||||
if isinstance(cm.exception, int):
|
||||
self.assertEqual(cm.exception, 2)
|
||||
else:
|
||||
self.assertEqual(cm.exception.code, 2)
|
||||
|
||||
@mock.patch('sys.stdout', new_callable=six.StringIO)
|
||||
@mock.patch('sys.stderr', new_callable=six.StringIO)
|
||||
|
|
@ -218,7 +224,10 @@ Options:
|
|||
self.session.build.assert_not_called()
|
||||
self.session.logout.assert_not_called()
|
||||
watch_tasks_mock.assert_not_called()
|
||||
self.assertEqual(cm.exception.code, 0)
|
||||
if isinstance(cm.exception, int):
|
||||
self.assertEqual(cm.exception, 0)
|
||||
else:
|
||||
self.assertEqual(cm.exception.code, 0)
|
||||
|
||||
@mock.patch('sys.stdout', new_callable=six.StringIO)
|
||||
@mock.patch('sys.stderr', new_callable=six.StringIO)
|
||||
|
|
@ -264,7 +273,10 @@ Options:
|
|||
self.session.build.assert_not_called()
|
||||
self.session.logout.assert_not_called()
|
||||
watch_tasks_mock.assert_not_called()
|
||||
self.assertEqual(cm.exception.code, 2)
|
||||
if isinstance(cm.exception, int):
|
||||
self.assertEqual(cm.exception, 2)
|
||||
else:
|
||||
self.assertEqual(cm.exception.code, 2)
|
||||
|
||||
@mock.patch('sys.stdout', new_callable=six.StringIO)
|
||||
@mock.patch('koji_cli.commands.activate_session')
|
||||
|
|
@ -354,7 +366,10 @@ Task info: weburl/taskinfo?taskID=1
|
|||
self.session.build.assert_not_called()
|
||||
self.session.logout.assert_not_called()
|
||||
watch_tasks_mock.assert_not_called()
|
||||
self.assertEqual(cm.exception.code, 2)
|
||||
if isinstance(cm.exception, int):
|
||||
self.assertEqual(cm.exception, 2)
|
||||
else:
|
||||
self.assertEqual(cm.exception.code, 2)
|
||||
|
||||
@mock.patch('sys.stderr', new_callable=six.StringIO)
|
||||
@mock.patch('koji_cli.commands.activate_session')
|
||||
|
|
@ -402,7 +417,10 @@ Task info: weburl/taskinfo?taskID=1
|
|||
self.session.build.assert_not_called()
|
||||
self.session.logout.assert_not_called()
|
||||
watch_tasks_mock.assert_not_called()
|
||||
self.assertEqual(cm.exception.code, 2)
|
||||
if isinstance(cm.exception, int):
|
||||
self.assertEqual(cm.exception, 2)
|
||||
else:
|
||||
self.assertEqual(cm.exception.code, 2)
|
||||
|
||||
@mock.patch('sys.stderr', new_callable=six.StringIO)
|
||||
@mock.patch('koji_cli.commands.activate_session')
|
||||
|
|
@ -450,7 +468,10 @@ Task info: weburl/taskinfo?taskID=1
|
|||
self.session.build.assert_not_called()
|
||||
self.session.logout.assert_not_called()
|
||||
watch_tasks_mock.assert_not_called()
|
||||
self.assertEqual(cm.exception.code, 2)
|
||||
if isinstance(cm.exception, int):
|
||||
self.assertEqual(cm.exception, 2)
|
||||
else:
|
||||
self.assertEqual(cm.exception.code, 2)
|
||||
|
||||
@mock.patch('sys.stdout', new_callable=six.StringIO)
|
||||
@mock.patch('koji_cli.commands.activate_session')
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue