diff options
Diffstat (limited to 'tests')
6 files changed, 19 insertions, 20 deletions
diff --git a/tests/unit/benchmark/contexts/standalone/test_model.py b/tests/unit/benchmark/contexts/standalone/test_model.py index 021c18860..6090356b6 100644 --- a/tests/unit/benchmark/contexts/standalone/test_model.py +++ b/tests/unit/benchmark/contexts/standalone/test_model.py @@ -12,8 +12,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -# Unittest for yardstick.benchmark.contexts.standalone.model - import copy import os import unittest @@ -182,6 +180,8 @@ class ModelLibvirtTestCase(unittest.TestCase): *args): # NOTE(ralonsoh): this test doesn't cover function execution. This test # should also check mocked function calls. + cfg_file = 'test_config_file.cfg' + self.addCleanup(os.remove, cfg_file) result = [4] with mock.patch("yardstick.ssh.SSH") as ssh: ssh_mock = mock.Mock(autospec=ssh.SSH) @@ -190,7 +190,7 @@ class ModelLibvirtTestCase(unittest.TestCase): ssh.return_value = ssh_mock mock_create_snapshot_qemu.return_value = "0.img" - status = model.Libvirt.build_vm_xml(ssh_mock, {}, "test", "vm_0", 0) + status = model.Libvirt.build_vm_xml(ssh_mock, {}, cfg_file, 'vm_0', 0) self.assertEqual(status[0], result[0]) def test_update_interrupts_hugepages_perf(self): 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 8fe0244bb..fb26f20b5 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') |