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

View File

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