Unsupported 'message' Exception attribute in PY3

The 'message' attribute has been deprecated and removed from Python3.
For more details, please check [1]:
[1] https://www.python.org/dev/peps/pep-0352/

This patch adds to the ones missed by https://review.openstack.org/#/c/487000/

Change-Id: I820779ddfcb2944a5c7f0b619ba58be103049516
This commit is contained in:
Adriano Petrich 2017-07-25 12:45:23 +01:00
parent 281668a000
commit 2373f41d95
10 changed files with 16 additions and 16 deletions

View File

@ -506,4 +506,4 @@ class DefaultEngineWithTransportTest(eng_test_base.EngineTestCase):
'some_description'
)
self.assertIn('KeyError: wrong key', exception.message)
self.assertIn('KeyError: wrong key', str(exception))

View File

@ -598,7 +598,7 @@ class DirectWorkflowEngineTest(base.EngineTestCase):
wf_text
)
self.assertIn("Task 'task3' not found", exception.message)
self.assertIn("Task 'task3' not found", str(exception))
def test_delete_workflow_completion_check_on_stop(self):
wf_text = """---

View File

@ -181,4 +181,4 @@ class ReverseWorkflowEngineTest(base.EngineTestCase):
wf_text
)
self.assertIn("Task 'task1' not found", exception.message)
self.assertIn("Task 'task1' not found", str(exception))

View File

@ -268,7 +268,7 @@ class RunActionEngineTest(base.EngineTestCase):
{'url': 'Hello, ', 'metod': 'John Doe!'}
)
self.assertIn('std.http', exception.message)
self.assertIn('std.http', str(exception))
def test_adhoc_action_wrong_input(self):
# Start action and see the result.
@ -279,7 +279,7 @@ class RunActionEngineTest(base.EngineTestCase):
{'left': 'Hello, ', 'ri': 'John Doe!'}
)
self.assertIn('concat', exception.message)
self.assertIn('concat', str(exception))
# TODO(rakhmerov): This is an example of a bad test. It pins to
# implementation details too much and prevents from making refactoring

View File

@ -534,7 +534,7 @@ class WithItemsEngineTest(base.EngineTestCase):
wb_service.create_workbook_v2, wb_text
)
self.assertIn("Invalid array in 'with-items'", exception.message)
self.assertIn("Invalid array in 'with-items'", str(exception))
def test_with_items_results_order(self):
wb_text = """---

View File

@ -26,7 +26,7 @@ class ActionSpecValidation(base.WorkbookSpecValidationTestCase):
exception = self._parse_dsl_spec(changes=actions, expect_error=True)
self.assertIn("'base' is a required property", exception.message)
self.assertIn("'base' is a required property", str(exception))
def test_base(self):
tests = [

View File

@ -285,7 +285,7 @@ class WorkbookSpecValidation(base.WorkbookSpecValidationTestCase):
yaml.safe_dump(dsl_dict)
)
self.assertIn("'name' is a required property", exception.message)
self.assertIn("'name' is a required property", str(exception))
def test_name(self):
tests = [

View File

@ -165,7 +165,7 @@ class WorkflowSpecValidation(base.WorkflowSpecValidationTestCase):
yaml.safe_dump(dsl_dict)
)
self.assertIn("'version' is a required property", exception.message)
self.assertIn("'version' is a required property", str(exception))
def test_version(self):
tests = [
@ -259,7 +259,7 @@ class WorkflowSpecValidation(base.WorkflowSpecValidationTestCase):
expect_error=True
)
self.assertIn("'tasks' is a required property", exception.message)
self.assertIn("'tasks' is a required property", str(exception))
def test_tasks(self):
tests = [
@ -402,7 +402,7 @@ class WorkflowSpecValidation(base.WorkflowSpecValidationTestCase):
exception = self._parse_dsl_spec(changes=overlay, expect_error=True)
self.assertIn("Invalid DSL", exception.message)
self.assertIn("Invalid DSL", str(exception))
def test_invalid_name(self):
invalid_wf = {
@ -423,5 +423,5 @@ class WorkflowSpecValidation(base.WorkflowSpecValidationTestCase):
self.assertIn(
"Workflow name cannot be in the format of UUID",
exception.message
str(exception)
)

View File

@ -183,8 +183,8 @@ class TriggerServiceV2Test(base.DbTestCase):
datetime.datetime(2010, 8, 25)
)
self.assertIn('Invalid input', exception.message)
self.assertIn('some_wf', exception.message)
self.assertIn('Invalid input', str(exception))
self.assertIn('some_wf', str(exception))
def test_oneshot_trigger_create(self):
trigger = t_s.create_cron_trigger(

View File

@ -170,7 +170,7 @@ class WorkflowServiceTest(base.DbTestCase):
WORKFLOW
)
self.assertIn("Workflow not found", exception.message)
self.assertIn("Workflow not found", str(exception))
def test_invalid_workflow_list(self):
exception = self.assertRaises(
@ -179,7 +179,7 @@ class WorkflowServiceTest(base.DbTestCase):
INVALID_WORKFLOW
)
self.assertIn("Invalid DSL", exception.message)
self.assertIn("Invalid DSL", str(exception))
def test_update_workflow_execution_env(self):
wf_exec_template = {