Use str(error) instead of error.message for py3 compat

This commit is contained in:
2016-01-07 20:42:05 +05:30
parent c171721a2d
commit dcd8355454
+4 -4
View File
@@ -61,7 +61,7 @@ def test_redis_fail_1(tmpdir):
with pytest.raises(redis.exceptions.ConnectionError) as error_info: with pytest.raises(redis.exceptions.ConnectionError) as error_info:
gui_backend.Controller(fake_app_gui).redraw() gui_backend.Controller(fake_app_gui).redraw()
assert error_info.value.message == "Cant connect to this socket. Is redis running?\n" \ assert str(error_info.value) == "Cant connect to this socket. Is redis running?\n" \
+ "Stopping pytest_status_gui" + "Stopping pytest_status_gui"
@@ -88,7 +88,7 @@ def test_redis_fail_2(tmpdir, redis_master):
with pytest.raises(redis.exceptions.ConnectionError) as error_info: with pytest.raises(redis.exceptions.ConnectionError) as error_info:
gui_backend.Controller(fake_app_gui).redraw() gui_backend.Controller(fake_app_gui).redraw()
assert error_info.value.message == "Redis is running on this port, but it is not related to pytest status\n"\ assert str(error_info.value) == "Redis is running on this port, but it is not related to pytest status\n"\
+ "Stopping pytest_status_gui" + "Stopping pytest_status_gui"
fake_app_gui.stop.assert_called_with() fake_app_gui.stop.assert_called_with()
@@ -118,7 +118,7 @@ def test_redis_fail_3(tmpdir, redis_master):
with pytest.raises(redis.exceptions.ConnectionError) as error_info: with pytest.raises(redis.exceptions.ConnectionError) as error_info:
gui_backend.Controller(fake_app_gui).redraw() gui_backend.Controller(fake_app_gui).redraw()
assert error_info.value.message == "Redis is running on this port, but it is not related to pytest status\n"\ assert str(error_info.value) == "Redis is running on this port, but it is not related to pytest status\n"\
+ "Stopping pytest_status_gui" + "Stopping pytest_status_gui"
fake_app_gui.stop.assert_called_with() fake_app_gui.stop.assert_called_with()
@@ -148,7 +148,7 @@ def test_redis_fail_4(tmpdir, redis_master):
with pytest.raises(redis.exceptions.ConnectionError) as error_info: with pytest.raises(redis.exceptions.ConnectionError) as error_info:
gui_backend.Controller(fake_app_gui).redraw() gui_backend.Controller(fake_app_gui).redraw()
assert error_info.value.message == "dir_name = {dir_name} not found in redis db".format( assert str(error_info.value) == "dir_name = {dir_name} not found in redis db".format(
dir_name=fake_app_gui.dir_name) dir_name=fake_app_gui.dir_name)
fake_app_gui.stop.assert_called_with() fake_app_gui.stop.assert_called_with()