]> git.apps.os.sepia.ceph.com Git - teuthology.git/commitdiff
contextutil: fix test for py3 compat
authorKyr Shatskyy <kyrylo.shatskyy@suse.com>
Tue, 19 Nov 2019 23:59:27 +0000 (00:59 +0100)
committerKyr Shatskyy <kyrylo.shatskyy@gmail.com>
Thu, 21 Nov 2019 21:16:10 +0000 (22:16 +0100)
Signed-off-by: Kyr Shatskyy <kyrylo.shatskyy@suse.com>
teuthology/test/test_contextutil.py

index c82060427e697277d2f5ba4fcbfd7f48f62cf95b..d7d1f4323f2cf5fba6f7644a78cc5e50ed4a3075 100644 (file)
@@ -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: