The message attribute on exception is deprecated

One should rather use str(exception) to get the text message.

Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
This commit is contained in:
Lubomír Sedlář 2016-05-25 13:22:47 +02:00
parent 6e10d8c713
commit 9ab9aaf8d9
2 changed files with 5 additions and 5 deletions

View File

@ -183,7 +183,7 @@ class TestBuildinstallPhase(PungiTestCase):
phase.validate()
self.assertIn('Deprecated config option: buildinstall_upgrade_image',
ctx.exception.message)
str(ctx.exception))
def test_lorax_options_with_buildinstall(self):
compose = BuildInstallCompose(self.topdir, {
@ -197,8 +197,8 @@ class TestBuildinstallPhase(PungiTestCase):
with self.assertRaises(ValueError) as ctx:
phase.validate()
self.assertIn('buildinstall', ctx.exception.message)
self.assertIn('lorax_options', ctx.exception.message)
self.assertIn('buildinstall', str(ctx.exception))
self.assertIn('lorax_options', str(ctx.exception))
@mock.patch('pungi.phases.buildinstall.ThreadPool')
@mock.patch('pungi.phases.buildinstall.LoraxWrapper')

View File

@ -442,7 +442,7 @@ class RunBlockingCmdTest(KojiWrapperBaseTestCase):
self.assertItemsEqual(run.mock_calls,
[mock.call('cmd', can_fail=True, logfile=None)])
self.assertIn('Could not find task ID', ctx.exception.message)
self.assertIn('Could not find task ID', str(ctx.exception))
@mock.patch('pungi.wrappers.kojiwrapper.run')
def test_disconnect_and_retry(self, run):
@ -497,7 +497,7 @@ class RunBlockingCmdTest(KojiWrapperBaseTestCase):
with self.assertRaises(RuntimeError) as ctx:
self.koji.run_blocking_cmd('cmd', max_retries=2)
self.assertIn('Failed to wait', ctx.exception.message)
self.assertIn('Failed to wait', str(ctx.exception))
self.assertEqual(run.mock_calls,
[mock.call('cmd', can_fail=True, logfile=None),
mock.call(['koji', 'watch-task', '1234'], can_fail=True, logfile=None),