Replace assertRaisesRegexp with assertRaisesRegex

assertRaisesRegexp was renamed to assertRaisesRegex in Py3.2
For more details, please check:
https://docs.python.org/3/library/
unittest.html#unittest.TestCase.assertRaisesRegex

Change-Id: I705c958c0dbf1daa409ed29ccbc038426298c306
Closes-Bug: #1436957
This commit is contained in:
Vu Cong Tuan 2017-06-03 12:57:24 +07:00
parent 5a045e036d
commit cae44c7eea
2 changed files with 23 additions and 23 deletions

View File

@ -61,7 +61,7 @@ class TestConfigParsing(TestConfig):
# test a config that has multiple keys for a top-level entry # test a config that has multiple keys for a top-level entry
def test_config_multikey_node(self): def test_config_multikey_node(self):
config = self.load_config_file('multi_key_node.yaml') config = self.load_config_file('multi_key_node.yaml')
self.assertRaisesRegexp(BlockDeviceSetupException, self.assertRaisesRegex(BlockDeviceSetupException,
"Config entry top-level should be a single " "Config entry top-level should be a single "
"dict:", "dict:",
config_tree_to_graph, config_tree_to_graph,
@ -101,7 +101,7 @@ class TestCreateGraph(TestGraphGeneration):
# Test a graph with bad edge pointing to an invalid node # Test a graph with bad edge pointing to an invalid node
def test_invalid_missing(self): def test_invalid_missing(self):
config = self.load_config_file('bad_edge_graph.yaml') config = self.load_config_file('bad_edge_graph.yaml')
self.assertRaisesRegexp(BlockDeviceSetupException, self.assertRaisesRegex(BlockDeviceSetupException,
"Edge not defined: this_is_not_a_node", "Edge not defined: this_is_not_a_node",
create_graph, create_graph,
config, self.fake_default_config) config, self.fake_default_config)
@ -109,7 +109,7 @@ class TestCreateGraph(TestGraphGeneration):
# Test a graph with bad edge pointing to an invalid node # Test a graph with bad edge pointing to an invalid node
def test_duplicate_name(self): def test_duplicate_name(self):
config = self.load_config_file('duplicate_name.yaml') config = self.load_config_file('duplicate_name.yaml')
self.assertRaisesRegexp(BlockDeviceSetupException, self.assertRaisesRegex(BlockDeviceSetupException,
"Duplicate node name: " "Duplicate node name: "
"this_is_a_duplicate", "this_is_a_duplicate",
create_graph, create_graph,

View File

@ -96,12 +96,12 @@ class TestState(TestStateBase):
# simulate the state somehow going missing, and ensure that # simulate the state somehow going missing, and ensure that
# later calls notice # later calls notice
os.unlink(state_file) os.unlink(state_file)
self.assertRaisesRegexp(BlockDeviceSetupException, self.assertRaisesRegex(BlockDeviceSetupException,
"State dump not found", "State dump not found",
bd_obj.cmd_cleanup) bd_obj.cmd_cleanup)
self.assertRaisesRegexp(BlockDeviceSetupException, self.assertRaisesRegex(BlockDeviceSetupException,
"State dump not found", "State dump not found",
bd_obj.cmd_writefstab) bd_obj.cmd_writefstab)
self.assertRaisesRegexp(BlockDeviceSetupException, self.assertRaisesRegex(BlockDeviceSetupException,
"State dump not found", "State dump not found",
bd_obj.cmd_delete) bd_obj.cmd_delete)