summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEmma Foley <emma.l.foley@intel.com>2017-12-19 11:45:57 +0000
committerEmma Foley <emma.l.foley@intel.com>2018-01-25 20:23:08 +0000
commit298e2e529e815f31c7ae5e0e1154a7fdac92a067 (patch)
treee8be63b8bf23dbed871824c33ca44c6a15e5abba
parent44ee5e004f3af5dcdbbc1d172faba91b8419b6d6 (diff)
Replace assertEquals with assertEqual
unittest.assertEquals is deprecated[1], and has been replaced with unittest.assertEqual. [1] https://docs.python.org/2/library/unittest.html#deprecated-aliases Change-Id: I9c6320e3a9ec5528036b529a9c32fc48b0bcfd62 JIRA: YARDSTICK-864 Signed-off-by: Emma Foley <emma.l.foley@intel.com>
-rw-r--r--tests/unit/benchmark/scenarios/availability/test_util.py4
-rw-r--r--tests/unit/network_services/helpers/test_dpdkbindnic_helper.py21
-rw-r--r--tests/unit/network_services/vnf_generic/vnf/test_sample_vnf.py4
-rw-r--r--tests/unit/network_services/vnf_generic/vnf/test_tg_ping.py2
-rw-r--r--tests/unit/network_services/vnf_generic/vnf/test_udp_replay.py2
-rw-r--r--yardstick/tests/unit/common/test_yaml_loader.py2
6 files changed, 17 insertions, 18 deletions
diff --git a/tests/unit/benchmark/scenarios/availability/test_util.py b/tests/unit/benchmark/scenarios/availability/test_util.py
index 55a0d160a..548efe91b 100644
--- a/tests/unit/benchmark/scenarios/availability/test_util.py
+++ b/tests/unit/benchmark/scenarios/availability/test_util.py
@@ -39,11 +39,11 @@ class ExecuteShellTestCase(unittest.TestCase):
def test_read_stdout_item(self):
result = util.read_stdout_item(self.std_output, 'id')
- self.assertEquals('1', result)
+ self.assertEqual('1', result)
def test_buildshellparams(self):
result = util.buildshellparams(self.cmd_config, True)
- self.assertEquals('/bin/bash -s {0} {1}', result)
+ self.assertEqual('/bin/bash -s {0} {1}', result)
def test__fun_execute_shell_command_successful(self):
cmd = "env"
diff --git a/tests/unit/network_services/helpers/test_dpdkbindnic_helper.py b/tests/unit/network_services/helpers/test_dpdkbindnic_helper.py
index 0f1cf7d92..9bb5ed3a7 100644
--- a/tests/unit/network_services/helpers/test_dpdkbindnic_helper.py
+++ b/tests/unit/network_services/helpers/test_dpdkbindnic_helper.py
@@ -25,8 +25,6 @@ from yardstick.network_services.helpers.dpdkbindnic_helper import CRYPTO_DPDK
from yardstick.network_services.helpers.dpdkbindnic_helper import NETWORK_OTHER
from yardstick.network_services.helpers.dpdkbindnic_helper import CRYPTO_OTHER
-pass
-
class TestDpdkBindHelper(unittest.TestCase):
EXAMPLE_OUTPUT = """
@@ -116,8 +114,8 @@ Other crypto devices
dpdk_bind_helper = DpdkBindHelper(conn)
- self.assertEquals(conn, dpdk_bind_helper.ssh_helper)
- self.assertEquals(self.CLEAN_STATUS, dpdk_bind_helper.dpdk_status)
+ self.assertEqual(conn, dpdk_bind_helper.ssh_helper)
+ self.assertEqual(self.CLEAN_STATUS, dpdk_bind_helper.dpdk_status)
self.assertIsNone(dpdk_bind_helper.status_nic_row_re)
self.assertIsNone(dpdk_bind_helper._dpdk_nic_bind_attr)
self.assertIsNone(dpdk_bind_helper._status_cmd_attr)
@@ -127,7 +125,8 @@ Other crypto devices
conn.execute = mock.Mock(return_value=(0, 'output', 'error'))
conn.provision_tool = mock.Mock(return_value='tool_path')
dpdk_bind_helper = DpdkBindHelper(conn)
- self.assertEquals((0, 'output', 'error'), dpdk_bind_helper._dpdk_execute('command'))
+ self.assertEqual((0, 'output', 'error'),
+ dpdk_bind_helper._dpdk_execute('command'))
def test__dpdk_execute_failure(self):
conn = mock.Mock()
@@ -145,7 +144,7 @@ Other crypto devices
dpdk_bind_helper._addline(NETWORK_KERNEL, self.ONE_INPUT_LINE)
self.assertIsNotNone(dpdk_bind_helper.dpdk_status)
- self.assertEquals(self.ONE_INPUT_LINE_PARSED, dpdk_bind_helper.dpdk_status[NETWORK_KERNEL])
+ self.assertEqual(self.ONE_INPUT_LINE_PARSED, dpdk_bind_helper.dpdk_status[NETWORK_KERNEL])
def test__switch_active_dict_by_header(self):
line = "Crypto devices using DPDK-compatible driver"
@@ -165,7 +164,7 @@ Other crypto devices
dpdk_bind_helper.parse_dpdk_status_output(self.EXAMPLE_OUTPUT)
self.maxDiff = None
- self.assertEquals(self.PARSED_EXAMPLE, dpdk_bind_helper.dpdk_status)
+ self.assertEqual(self.PARSED_EXAMPLE, dpdk_bind_helper.dpdk_status)
def test_read_status(self):
conn = mock.Mock()
@@ -174,7 +173,7 @@ Other crypto devices
dpdk_bind_helper = DpdkBindHelper(conn)
- self.assertEquals(self.PARSED_EXAMPLE, dpdk_bind_helper.read_status())
+ self.assertEqual(self.PARSED_EXAMPLE, dpdk_bind_helper.read_status())
def test__get_bound_pci_addresses(self):
conn = mock.Mock()
@@ -183,9 +182,9 @@ Other crypto devices
dpdk_bind_helper.parse_dpdk_status_output(self.EXAMPLE_OUTPUT)
- self.assertEquals(['0000:00:04.0', '0000:00:05.0'],
+ self.assertEqual(['0000:00:04.0', '0000:00:05.0'],
dpdk_bind_helper._get_bound_pci_addresses(NETWORK_DPDK))
- self.assertEquals(['0000:00:03.0'],
+ self.assertEqual(['0000:00:03.0'],
dpdk_bind_helper._get_bound_pci_addresses(NETWORK_KERNEL))
def test_interface_driver_map(self):
@@ -195,7 +194,7 @@ Other crypto devices
dpdk_bind_helper.parse_dpdk_status_output(self.EXAMPLE_OUTPUT)
- self.assertEquals({'0000:00:04.0': 'igb_uio',
+ self.assertEqual({'0000:00:04.0': 'igb_uio',
'0000:00:03.0': 'virtio-pci',
'0000:00:05.0': 'igb_uio',
},
diff --git a/tests/unit/network_services/vnf_generic/vnf/test_sample_vnf.py b/tests/unit/network_services/vnf_generic/vnf/test_sample_vnf.py
index beb4f8f9f..af941c04f 100644
--- a/tests/unit/network_services/vnf_generic/vnf/test_sample_vnf.py
+++ b/tests/unit/network_services/vnf_generic/vnf/test_sample_vnf.py
@@ -704,8 +704,8 @@ class TestDpdkVnfSetupEnvHelper(unittest.TestCase):
intf_0 = vnfd_helper.vdu[0]['external-interface'][0]['virtual-interface']
intf_1 = vnfd_helper.vdu[0]['external-interface'][1]['virtual-interface']
- self.assertEquals(0, intf_0['dpdk_port_num'])
- self.assertEquals(1, intf_1['dpdk_port_num'])
+ self.assertEqual(0, intf_0['dpdk_port_num'])
+ self.assertEqual(1, intf_1['dpdk_port_num'])
def test_tear_down(self):
vnfd_helper = VnfdHelper(self.VNFD_0)
diff --git a/tests/unit/network_services/vnf_generic/vnf/test_tg_ping.py b/tests/unit/network_services/vnf_generic/vnf/test_tg_ping.py
index 8bf589281..f8ff60288 100644
--- a/tests/unit/network_services/vnf_generic/vnf/test_tg_ping.py
+++ b/tests/unit/network_services/vnf_generic/vnf/test_tg_ping.py
@@ -238,7 +238,7 @@ class TestPingTrafficGen(unittest.TestCase):
self.assertIsInstance(ping_traffic_gen.setup_helper, PingSetupEnvHelper)
self.assertIsInstance(ping_traffic_gen.resource_helper, PingResourceHelper)
- self.assertEquals(ping_traffic_gen._result, {})
+ self.assertEqual(ping_traffic_gen._result, {})
@mock.patch("yardstick.ssh.SSH")
def test__bind_device_kernel_with_failure(self, ssh):
diff --git a/tests/unit/network_services/vnf_generic/vnf/test_udp_replay.py b/tests/unit/network_services/vnf_generic/vnf/test_udp_replay.py
index 635ce2735..cda3852fe 100644
--- a/tests/unit/network_services/vnf_generic/vnf/test_udp_replay.py
+++ b/tests/unit/network_services/vnf_generic/vnf/test_udp_replay.py
@@ -447,7 +447,7 @@ class TestUdpReplayApproxVnf(unittest.TestCase):
udp_replay_approx_vnf._vnf_process.is_alive = mock.Mock(return_value=1)
udp_replay_approx_vnf._vnf_process.exitcode = 0
- self.assertEquals(udp_replay_approx_vnf.wait_for_instantiate(), 0)
+ self.assertEqual(udp_replay_approx_vnf.wait_for_instantiate(), 0)
@mock.patch("yardstick.network_services.vnf_generic.vnf.sample_vnf.Context")
@mock.patch('yardstick.ssh.SSH')
diff --git a/yardstick/tests/unit/common/test_yaml_loader.py b/yardstick/tests/unit/common/test_yaml_loader.py
index 90cbb8157..6c2beb422 100644
--- a/yardstick/tests/unit/common/test_yaml_loader.py
+++ b/yardstick/tests/unit/common/test_yaml_loader.py
@@ -22,7 +22,7 @@ class TemplateFormatTestCase(unittest.TestCase):
def test_parse_to_value_exception(self):
- self.assertEquals(yaml_loader.yaml_load("string"), u"string")
+ self.assertEqual(yaml_loader.yaml_load("string"), u"string")
def main():