From 298e2e529e815f31c7ae5e0e1154a7fdac92a067 Mon Sep 17 00:00:00 2001 From: Emma Foley Date: Tue, 19 Dec 2017 11:45:57 +0000 Subject: 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 --- .../benchmark/scenarios/availability/test_util.py | 4 ++-- .../helpers/test_dpdkbindnic_helper.py | 21 ++++++++++----------- .../vnf_generic/vnf/test_sample_vnf.py | 4 ++-- .../vnf_generic/vnf/test_tg_ping.py | 2 +- .../vnf_generic/vnf/test_udp_replay.py | 2 +- 5 files changed, 16 insertions(+), 17 deletions(-) (limited to 'tests/unit') 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') -- cgit 1.2.3-korg