From b7b5d2b2dad58c34bc3664f12b1796df8d53a1a0 Mon Sep 17 00:00:00 2001 From: Kyr Shatskyy Date: Wed, 20 Nov 2019 00:59:27 +0100 Subject: [PATCH] contextutil: fix test for py3 compat Signed-off-by: Kyr Shatskyy --- teuthology/test/test_contextutil.py | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/teuthology/test/test_contextutil.py b/teuthology/test/test_contextutil.py index c82060427e..d7d1f4323f 100644 --- a/teuthology/test/test_contextutil.py +++ b/teuthology/test/test_contextutil.py @@ -25,8 +25,7 @@ class TestSafeWhile(object): while proceed(): pass - msg = error.value[0] - assert 'waiting for 6 seconds' in msg + assert 'waiting for 6 seconds' in str(error) def test_1_0_10_deal(self): with raises(contextutil.MaxWhileTries) as error: @@ -37,8 +36,7 @@ class TestSafeWhile(object): while proceed(): pass - msg = error.value[0] - assert 'waiting for 10 seconds' in msg + assert 'waiting for 10 seconds' in str(error) def test_6_1_10_deal(self): with raises(contextutil.MaxWhileTries) as error: @@ -49,8 +47,7 @@ class TestSafeWhile(object): while proceed(): pass - msg = error.value[0] - assert 'waiting for 105 seconds' in msg + assert 'waiting for 105 seconds' in str(error) def test_action(self): with raises(contextutil.MaxWhileTries) as error: @@ -61,8 +58,7 @@ class TestSafeWhile(object): while proceed(): pass - msg = error.value[0] - assert "'doing the thing' reached maximum tries" in msg + assert "'doing the thing' reached maximum tries" in str(error) def test_no_raise(self): with self.s_while(_raise=False, _sleeper=self.fake_sleep) as proceed: -- 2.39.5