From 9ab9aaf8d989c65fe4d1dfb6f259abe1ce6ee3ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lubom=C3=ADr=20Sedl=C3=A1=C5=99?= Date: Wed, 25 May 2016 13:22:47 +0200 Subject: [PATCH] The message attribute on exception is deprecated MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit One should rather use str(exception) to get the text message. Signed-off-by: Lubomír Sedlář --- tests/test_buildinstall.py | 6 +++--- tests/test_koji_wrapper.py | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/test_buildinstall.py b/tests/test_buildinstall.py index 6cfb1e05..48d5bbf6 100755 --- a/tests/test_buildinstall.py +++ b/tests/test_buildinstall.py @@ -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') diff --git a/tests/test_koji_wrapper.py b/tests/test_koji_wrapper.py index 185ad7f5..1a043824 100755 --- a/tests/test_koji_wrapper.py +++ b/tests/test_koji_wrapper.py @@ -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),