From Dan Kenigsberg danken@redhat.com:
Dan Kenigsberg has uploaded a new change for review.
Change subject: tests: remove remaining assertEquals ......................................................................
tests: remove remaining assertEquals
fixes done with
/tmp/q0: q0/assertEquals<^M>lllllllllllx%mn%:.+1,'ns/^ //<^M>q20@0:wq for f in `git grep -l assertEquals`; do vim -s /tmp/q0 $f; done for f in `git diff --name-only`; do flake8 $f && git add $f; done
and few manual fixes
Change-Id: I7dc92f9827c8bd2c3d284f518e705ea50e4ac8ae Signed-off-by: Dan Kenigsberg danken@redhat.com --- M tests/bridge_test.py M tests/containers/docker_test.py M tests/containers/domain_test.py M tests/containers/doms_test.py M tests/containers/events_test.py M tests/containers/monitoring_test.py M tests/containers/recovery_test.py M tests/functional/vmQoSTests.py M tests/gluster_cli_test.py M tests/hoststats_test.py M tests/integration/jsonRpcTests.py M tests/network/tc_test.py M tests/qemuimg_test.py M tests/response_test.py M tests/stomp_test.py M tests/stompadapter_test.py M tests/stompasyncclient_test.py M tests/storage_directio_test.py M tests/storage_fileutil_test.py M tests/storage_iscsi_test.py M tests/storage_mailbox_test.py M tests/storage_merge_test.py M tests/storage_misc_test.py M tests/storage_resourcemanager_test.py M tests/storage_sd_manifest_test.py M tests/storage_storageserver_test.py M tests/tool_test.py M tests/utils_test.py M tests/v2v_test.py M tests/vdsclient_test.py M tests/vmmigration_test.py 31 files changed, 168 insertions(+), 168 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/50/69950/1
diff --git a/tests/bridge_test.py b/tests/bridge_test.py index d989f10..c8ac25a 100644 --- a/tests/bridge_test.py +++ b/tests/bridge_test.py @@ -136,16 +136,16 @@ "agent": "apc_snmp", "username": "emesika", "password": "pass", "action": "off", "options": "port=15"}
- self.assertEquals(bridge.dispatch('Host.fenceNode')(**params), - {'power': 'on'}) + self.assertEqual(bridge.dispatch('Host.fenceNode')(**params), + {'power': 'on'})
@MonkeyPatch(DynamicBridge, '_get_api_instance', _get_api_instance) def testMethodWithNoParams(self): bridge = DynamicBridge()
bridge.register_server_address('127.0.0.1') - self.assertEquals(bridge.dispatch('Host.getCapabilities')() - ['My caps'], 'My capabilites') + self.assertEqual(bridge.dispatch('Host.getCapabilities')() + ['My caps'], 'My capabilites') bridge.unregister_server_address()
@MonkeyPatch(DynamicBridge, '_get_api_instance', _get_api_instance) @@ -166,7 +166,7 @@ with self.assertRaises(JsonRpcError) as e: bridge.dispatch('Host.ping')()
- self.assertEquals(e.exception.code, 100) + self.assertEqual(e.exception.code, 100)
@MonkeyPatch(DynamicBridge, '_get_api_instance', _get_api_instance) def testMethodWithIntParam(self): diff --git a/tests/containers/docker_test.py b/tests/containers/docker_test.py index 82947a0..35eb1da 100644 --- a/tests/containers/docker_test.py +++ b/tests/containers/docker_test.py @@ -66,7 +66,7 @@ root = ET.fromstring(conttestlib.metadata_drive_map_dom_xml()) self.assertNotRaises(self.base.configure, root) conf = self.base._run_conf - self.assertEquals(conf.volume_mapping, { + self.assertEqual(conf.volume_mapping, { "data": "vda", }) # FIXME
diff --git a/tests/containers/domain_test.py b/tests/containers/domain_test.py index 9c21c45..19e94c7 100644 --- a/tests/containers/domain_test.py +++ b/tests/containers/domain_test.py @@ -126,8 +126,8 @@ def test_info(self): with conttestlib.fake_runtime_domain() as dom: info = dom.info() - self.assertEquals(info[0], - libvirt.VIR_DOMAIN_RUNNING) + self.assertEqual(info[0], + libvirt.VIR_DOMAIN_RUNNING)
class UnsupportedAPITests(conttestlib.RunnableTestCase): diff --git a/tests/containers/doms_test.py b/tests/containers/doms_test.py index cfc6426..79b4bc7 100644 --- a/tests/containers/doms_test.py +++ b/tests/containers/doms_test.py @@ -65,8 +65,8 @@ def test_get_by_uuid(self): dom_list = _fill_doms(NUM) # random pick - self.assertEquals(dom_list[1], - doms.get_by_uuid(dom_list[1].uuid)) + self.assertEqual(dom_list[1], + doms.get_by_uuid(dom_list[1].uuid))
def _fill_doms(num): diff --git a/tests/containers/events_test.py b/tests/containers/events_test.py index 298df9d..da2e33c 100644 --- a/tests/containers/events_test.py +++ b/tests/containers/events_test.py @@ -40,8 +40,8 @@ conttestlib.clear_events(events.root)
def test_without_registered(self): - self.assertEquals(tuple(sorted(events.root.registered)), - tuple()) + self.assertEqual(tuple(sorted(events.root.registered)), + tuple())
def test_register_any(self): libvirt_events = ( @@ -58,8 +58,8 @@ for ev in libvirt_events: conn.domainEventRegisterAny(None, ev, _handler, ev)
- self.assertEquals(tuple(sorted(libvirt_events)), - tuple(sorted(events.root.registered))) + self.assertEqual(tuple(sorted(libvirt_events)), + tuple(sorted(events.root.registered)))
def test_register_specific_dom(self): evt = libvirt.VIR_DOMAIN_EVENT_ID_LIFECYCLE @@ -74,10 +74,10 @@ conn.domainEventRegisterAny(dom, evt, _cb, None)
# FIXME - self.assertEquals(tuple(), - tuple(sorted(events.root.registered))) - self.assertEquals((evt,), - tuple(sorted(dom.events.registered))) + self.assertEqual(tuple(), + tuple(sorted(events.root.registered))) + self.assertEqual((evt,), + tuple(sorted(dom.events.registered)))
dom.events.fire(evt, None) self.assertTrue(called[0]) diff --git a/tests/containers/monitoring_test.py b/tests/containers/monitoring_test.py index ba57e3b..56fda9e 100644 --- a/tests/containers/monitoring_test.py +++ b/tests/containers/monitoring_test.py @@ -44,7 +44,7 @@ conn.domainEventRegisterAny(dom, evt, _cb, None) monitoring.watchdog(lambda: [])
- self.assertEquals(delivered, [( + self.assertEqual(delivered, [( conn, dom, libvirt.VIR_DOMAIN_EVENT_STOPPED, diff --git a/tests/containers/recovery_test.py b/tests/containers/recovery_test.py index 796b879..53ead4f 100644 --- a/tests/containers/recovery_test.py +++ b/tests/containers/recovery_test.py @@ -85,8 +85,8 @@
recovered_doms = containers.recoveryAllDomains() recovered_uuids = set(vm_uuids[1:]) - self.assertEquals(len(recovered_doms), - len(recovered_uuids)) + self.assertEqual(len(recovered_doms), + len(recovered_uuids)) for dom in recovered_doms: self.assertIn(dom.UUIDString(), recovered_uuids)
diff --git a/tests/functional/vmQoSTests.py b/tests/functional/vmQoSTests.py index 5c37cd2..65273e3 100644 --- a/tests/functional/vmQoSTests.py +++ b/tests/functional/vmQoSTests.py @@ -44,8 +44,8 @@
def assertCallSucceeded(self, result): code, message = result - self.assertEquals(code, SUCCESS, - 'error code: %s, message: %s' % (code, message)) + self.assertEqual(code, SUCCESS, + 'error code: %s, message: %s' % (code, message))
@requireKVM @skipNoMOM diff --git a/tests/gluster_cli_test.py b/tests/gluster_cli_test.py index f0b82f7..c3a1346 100644 --- a/tests/gluster_cli_test.py +++ b/tests/gluster_cli_test.py @@ -177,10 +177,10 @@ gcli._parsePeerStatus(tree, 'fedora-16-test', '711d2887-3222-46d8-801a-7e3f646bdd4d', gcli.HostStatus.CONNECTED) - self.assertEquals(hostList, - [{'hostname': 'fedora-16-test', - 'uuid': '711d2887-3222-46d8-801a-7e3f646bdd4d', - 'status': gcli.HostStatus.CONNECTED}]) + self.assertEqual(hostList, + [{'hostname': 'fedora-16-test', + 'uuid': '711d2887-3222-46d8-801a-7e3f646bdd4d', + 'status': gcli.HostStatus.CONNECTED}])
def _parsePeerStatus_test(self): out = """<?xml version="1.0" encoding="UTF-8" standalone="yes"?> @@ -218,19 +218,19 @@ gcli._parsePeerStatus(tree, 'fedora-16-test', '711d2887-3222-46d8-801a-7e3f646bdd4d', gcli.HostStatus.CONNECTED) - self.assertEquals(hostList, - [{'hostname': 'fedora-16-test', - 'uuid': '711d2887-3222-46d8-801a-7e3f646bdd4d', - 'status': gcli.HostStatus.CONNECTED}, - {'hostname': '192.168.2.21', - 'uuid': '610f466c-781a-4e04-8f67-8eba9a201867', - 'status': gcli.HostStatus.CONNECTED}, - {'hostname': 'FC16-1', - 'uuid': '12345678-781a-aaaa-bbbb-8eba9a201867', - 'status': gcli.HostStatus.DISCONNECTED}, - {'hostname': 'FC16-2', - 'uuid': '12345678-cccc-aaaa-bbbb-8eba9a201867', - 'status': gcli.HostStatus.UNKNOWN}]) + self.assertEqual(hostList, + [{'hostname': 'fedora-16-test', + 'uuid': '711d2887-3222-46d8-801a-7e3f646bdd4d', + 'status': gcli.HostStatus.CONNECTED}, + {'hostname': '192.168.2.21', + 'uuid': '610f466c-781a-4e04-8f67-8eba9a201867', + 'status': gcli.HostStatus.CONNECTED}, + {'hostname': 'FC16-1', + 'uuid': '12345678-781a-aaaa-bbbb-8eba9a201867', + 'status': gcli.HostStatus.DISCONNECTED}, + {'hostname': 'FC16-2', + 'uuid': '12345678-cccc-aaaa-bbbb-8eba9a201867', + 'status': gcli.HostStatus.UNKNOWN}])
def test_parsePeerStatus(self): self._parsePeerStatus_empty_test() @@ -302,34 +302,34 @@ """ tree = etree.fromstring(out) status = gcli._parseVolumeStatus(tree) - self.assertEquals(status, - {'bricks': [{'brick': '192.168.122.2:/tmp/music-b1', - 'hostuuid': - 'f06b108e-a780-4519-bb22-c3083a1e3f8a', - 'pid': '1313', - 'port': '49152', - 'rdma_port': 'N/A', - 'status': 'ONLINE'}, - {'brick': '192.168.122.2:/tmp/music-b2', - 'hostuuid': - 'f06b108e-a780-4519-bb22-c3083a1e3f8a', - 'pid': '1335', - 'port': '49153', - 'rdma_port': 'N/A', - 'status': 'ONLINE'}], - 'name': 'music', - 'nfs': [{'hostname': '192.168.122.2', - 'hostuuid': - 'f06b108e-a780-4519-bb22-c3083a1e3f8a', - 'pid': '1357', - 'port': '38467', - 'rdma_port': 'N/A', - 'status': 'ONLINE'}], - 'shd': [{'hostname': '192.168.122.2', - 'hostuuid': - 'f06b108e-a780-4519-bb22-c3083a1e3f8a', - 'pid': '1375', - 'status': 'ONLINE'}]}) + self.assertEqual(status, + {'bricks': [{'brick': '192.168.122.2:/tmp/music-b1', + 'hostuuid': + 'f06b108e-a780-4519-bb22-c3083a1e3f8a', + 'pid': '1313', + 'port': '49152', + 'rdma_port': 'N/A', + 'status': 'ONLINE'}, + {'brick': '192.168.122.2:/tmp/music-b2', + 'hostuuid': + 'f06b108e-a780-4519-bb22-c3083a1e3f8a', + 'pid': '1335', + 'port': '49153', + 'rdma_port': 'N/A', + 'status': 'ONLINE'}], + 'name': 'music', + 'nfs': [{'hostname': '192.168.122.2', + 'hostuuid': + 'f06b108e-a780-4519-bb22-c3083a1e3f8a', + 'pid': '1357', + 'port': '38467', + 'rdma_port': 'N/A', + 'status': 'ONLINE'}], + 'shd': [{'hostname': '192.168.122.2', + 'hostuuid': + 'f06b108e-a780-4519-bb22-c3083a1e3f8a', + 'pid': '1375', + 'status': 'ONLINE'}]})
def _parseVolumeStatusDetail_test(self): out = """<?xml version="1.0" encoding="UTF-8" standalone="yes"?> @@ -1157,8 +1157,8 @@ out = f.read() tree = etree.fromstring(out) status = gcli._parseVolumeRebalanceRemoveBrickStatus(tree, 'rebalance') - self.assertEquals(status, - glusterTestData.REBALANCE_REMOVE_BRICK_STATUS) + self.assertEqual(status, + glusterTestData.REBALANCE_REMOVE_BRICK_STATUS)
def test_parseVolumeRemoveBricksStatus(self): with open("glusterVolumeRemoveBricksStatus.xml") as f: @@ -1166,8 +1166,8 @@ tree = etree.fromstring(out) status = gcli._parseVolumeRebalanceRemoveBrickStatus(tree, 'remove-brick') - self.assertEquals(status, - glusterTestData.REBALANCE_REMOVE_BRICK_STATUS) + self.assertEqual(status, + glusterTestData.REBALANCE_REMOVE_BRICK_STATUS)
def test_parseVolumeTasks(self): with open("glusterVolumeTasks.xml") as f: @@ -1211,8 +1211,8 @@ tree = etree.fromstring(out) gcli._TIME_ZONE = 'IST' status = gcli._parseAllVolumeSnapshotList(tree) - self.assertEquals(status, - glusterTestData.GLUSTER_ALL_VOLUME_SNAPSHOT_LIST) + self.assertEqual(status, + glusterTestData.GLUSTER_ALL_VOLUME_SNAPSHOT_LIST)
def test_parseVolumeSnapshotList(self): with open("glusterVolumeSnapshotList.xml") as f: diff --git a/tests/hoststats_test.py b/tests/hoststats_test.py index 2f04d0c..d0c0f16 100644 --- a/tests/hoststats_test.py +++ b/tests/hoststats_test.py @@ -72,8 +72,8 @@ def testBootTimeOk(self): with MonkeyPatchScope([(hoststats, '_PROC_STAT_PATH', self._good_path)]): - self.assertEquals(hoststats.get_boot_time(), - 1395249141) + self.assertEqual(hoststats.get_boot_time(), + 1395249141)
def testBootTimeEmpty(self): with MonkeyPatchScope([(hoststats, '_PROC_STAT_PATH', diff --git a/tests/integration/jsonRpcTests.py b/tests/integration/jsonRpcTests.py index 74a60ed..9eb9682 100644 --- a/tests/integration/jsonRpcTests.py +++ b/tests/integration/jsonRpcTests.py @@ -113,8 +113,8 @@ response = client.send("echo", (data,)) self.assertEqual(response, data) else: - self.assertEquals(self._callTimeout(client, "echo", - (data,), CALL_ID), data) + self.assertEqual(self._callTimeout(client, "echo", + (data,), CALL_ID), data)
@permutations(PERMUTATIONS) def testMethodCallArgDict(self, ssl, type): @@ -127,8 +127,8 @@ response = client.send("echo", (data,)) self.assertEqual(response, data) else: - self.assertEquals(self._callTimeout(client, "echo", - {'text': data}, CALL_ID), data) + self.assertEqual(self._callTimeout(client, "echo", + {'text': data}, CALL_ID), data)
@permutations(PERMUTATIONS) def testMethodMissingMethod(self, ssl, type): @@ -145,7 +145,7 @@ self._callTimeout(client, missing_method, [], CALL_ID)
- self.assertEquals( + self.assertEqual( cm.exception.code, JsonRpcMethodNotFoundError(missing_method).code) self.assertIn(missing_method, cm.exception.message) @@ -166,8 +166,8 @@ self._callTimeout(client, "echo", [], CALL_ID)
- self.assertEquals(cm.exception.code, - JsonRpcInternalError().code) + self.assertEqual(cm.exception.code, + JsonRpcInternalError().code)
@permutations(PERMUTATIONS) def testMethodReturnsNullAndServerReturnsTrue(self, ssl, type): @@ -215,8 +215,8 @@ with self.assertRaises(JsonRpcError) as cm: self._callTimeout(client, "slow_response", [], CALL_ID)
- self.assertEquals(cm.exception.code, - JsonRpcNoResponseError().code) + self.assertEqual(cm.exception.code, + JsonRpcNoResponseError().code)
@MonkeyPatch(executor.Executor, 'dispatch', dispatch) @permutations(PERMUTATIONS) @@ -231,5 +231,5 @@ with self.assertRaises(JsonRpcError) as cm: self._callTimeout(client, "no_method", [], CALL_ID)
- self.assertEquals(cm.exception.code, - JsonRpcInternalError().code) + self.assertEqual(cm.exception.code, + JsonRpcInternalError().code) diff --git a/tests/network/tc_test.py b/tests/network/tc_test.py index e93591d..96b9421 100644 --- a/tests/network/tc_test.py +++ b/tests/network/tc_test.py @@ -77,8 +77,8 @@
def testQdiscsOfDevice(self): self._addIngress() - self.assertEquals(("ffff:", ), - tuple(tc._qdiscs_of_device(self._bridge.devName))) + self.assertEqual(("ffff:", ), + tuple(tc._qdiscs_of_device(self._bridge.devName)))
def testReplacePrio(self): self._addIngress() diff --git a/tests/qemuimg_test.py b/tests/qemuimg_test.py index 1bc7802..3d62fb2 100644 --- a/tests/qemuimg_test.py +++ b/tests/qemuimg_test.py @@ -546,8 +546,8 @@ qemuimg.create(leaf_path, format=qemuimg.FORMAT.QCOW2, backing=base_path) qemuimg.amend(leaf_path, desired_qcow2_compat) - self.assertEquals(qemuimg.info(leaf_path)['compat'], - desired_qcow2_compat) + self.assertEqual(qemuimg.info(leaf_path)['compat'], + desired_qcow2_compat)
def make_image(path, size, format, index, qcow2_compat, backing=None): diff --git a/tests/response_test.py b/tests/response_test.py index 49b301d..46f3aec 100644 --- a/tests/response_test.py +++ b/tests/response_test.py @@ -84,8 +84,8 @@ )) def test_is_specific_error(self, actual_err, expected_err): match = actual_err == expected_err - self.assertEquals(match, response.is_error(response.error(actual_err), - err=expected_err)) + self.assertEqual(match, response.is_error(response.error(actual_err), + err=expected_err))
def test_malformed_empty(self): self.assertRaises(response.MalformedResponse, diff --git a/tests/stomp_test.py b/tests/stomp_test.py index f92a1d3..e4e36b0 100644 --- a/tests/stomp_test.py +++ b/tests/stomp_test.py @@ -96,9 +96,9 @@ 'jms.topic.vdsm_requests', str(uuid4()), sslctx)) as client: - self.assertEquals(client.callMethod('echo', (data,), - str(uuid4())), - data) + self.assertEqual(client.callMethod('echo', (data,), + str(uuid4())), + data)
@brokentest('This test randomly fails on CI with JsonRpcNoResponseError') @permutations(_USE_SSL) diff --git a/tests/stompadapter_test.py b/tests/stompadapter_test.py index 1ab4d32..bf02d14 100644 --- a/tests/stompadapter_test.py +++ b/tests/stompadapter_test.py @@ -153,10 +153,10 @@ adapter.handle_frame(TestDispatcher(adapter), frame)
subscription = destinations['jms.queue.events'][0] - self.assertEquals(subscription.id, - 'ad052acb-a934-4e10-8ec3-00c7417ef8d1') - self.assertEquals(subscription.destination, - 'jms.queue.events') + self.assertEqual(subscription.id, + 'ad052acb-a934-4e10-8ec3-00c7417ef8d1') + self.assertEqual(subscription.destination, + 'jms.queue.events')
def test_no_destination(self): frame = Frame(Command.SUBSCRIBE, @@ -168,8 +168,8 @@
resp_frame = adapter.pop_message() self.assertEqual(resp_frame.command, Command.ERROR) - self.assertEquals(resp_frame.body, - 'Missing destination or subscription id header') + self.assertEqual(resp_frame.body, + 'Missing destination or subscription id header')
def test_no_id(self): frame = Frame(Command.SUBSCRIBE, @@ -181,8 +181,8 @@
resp_frame = adapter.pop_message() self.assertEqual(resp_frame.command, Command.ERROR) - self.assertEquals(resp_frame.body, - 'Missing destination or subscription id header') + self.assertEqual(resp_frame.body, + 'Missing destination or subscription id header')
class UnsubscribeFrameTest(TestCaseBase): diff --git a/tests/stompasyncclient_test.py b/tests/stompasyncclient_test.py index 6bc90f7..3408ce5 100644 --- a/tests/stompasyncclient_test.py +++ b/tests/stompasyncclient_test.py @@ -89,10 +89,10 @@
req_frame = client.pop_message() self.assertEqual(req_frame.command, Command.SEND) - self.assertEquals(req_frame.headers['destination'], - 'jms.topic.vdsm_requests') - self.assertEquals(req_frame.headers[Headers.REPLY_TO], - 'jms.topic.vdsm_responses') + self.assertEqual(req_frame.headers['destination'], + 'jms.topic.vdsm_requests') + self.assertEqual(req_frame.headers[Headers.REPLY_TO], + 'jms.topic.vdsm_responses') self.assertEqual(req_frame.body, data)
def test_receive_connected(self): diff --git a/tests/storage_directio_test.py b/tests/storage_directio_test.py index b1007bf..29c1374 100644 --- a/tests/storage_directio_test.py +++ b/tests/storage_directio_test.py @@ -86,8 +86,8 @@ with temporaryPath(data=self.DATA) as srcPath, \ directio.DirectFile(srcPath, "r") as direct_file, \ io.open(srcPath, "rb") as buffered_file: - self.assertEquals(direct_file.readlines(), - buffered_file.readlines()) + self.assertEqual(direct_file.readlines(), + buffered_file.readlines())
def test_read_all(self): with temporaryPath(data=self.DATA) as srcPath, \ diff --git a/tests/storage_fileutil_test.py b/tests/storage_fileutil_test.py index 60188ac..b6ab274 100644 --- a/tests/storage_fileutil_test.py +++ b/tests/storage_fileutil_test.py @@ -114,8 +114,8 @@ for initialMode, expectedMode in self.modesList: os.chmod(path, initialMode) fileUtils.copyUserModeToGroup(path) - self.assertEquals(os.stat(path).st_mode & self.MODE_MASK, - expectedMode) + self.assertEqual(os.stat(path).st_mode & self.MODE_MASK, + expectedMode)
class TestAtomicSymlink(TestCaseBase): diff --git a/tests/storage_iscsi_test.py b/tests/storage_iscsi_test.py index cac3c7e..a641951 100644 --- a/tests/storage_iscsi_test.py +++ b/tests/storage_iscsi_test.py @@ -175,7 +175,7 @@ "3ffe:2a00:100:7031::1", 3260), 1, "iqn.2014-06.com.example:t1") - self.assertEquals( + self.assertEqual( str(target), "[3ffe:2a00:100:7031::1]:3260,1 iqn.2014-06.com.example:t1")
diff --git a/tests/storage_mailbox_test.py b/tests/storage_mailbox_test.py index 08cce80..e73b656 100644 --- a/tests/storage_mailbox_test.py +++ b/tests/storage_mailbox_test.py @@ -75,7 +75,7 @@ mailer.stop() mailer.run()
- t = lambda: self.assertEquals( + t = lambda: self.assertEqual( threadCount, len(threading.enumerate())) retry(AssertionError, t, timeout=4, sleep=0.1) finally: diff --git a/tests/storage_merge_test.py b/tests/storage_merge_test.py index ffce605..9dc4768 100644 --- a/tests/storage_merge_test.py +++ b/tests/storage_merge_test.py @@ -379,15 +379,15 @@ self.assertEqual(info['backingfile'], base_vol.volumePath)
# verify syncVolumeChain arguments - self.assertEquals(image.Image.syncVolumeChain.sd_id, - subchain.sd_id) - self.assertEquals(image.Image.syncVolumeChain.img_id, - subchain.img_id) - self.assertEquals(image.Image.syncVolumeChain.vol_id, - env.chain[-1].volUUID) + self.assertEqual(image.Image.syncVolumeChain.sd_id, + subchain.sd_id) + self.assertEqual(image.Image.syncVolumeChain.img_id, + subchain.img_id) + self.assertEqual(image.Image.syncVolumeChain.vol_id, + env.chain[-1].volUUID) new_chain = [vol.volUUID for vol in env.chain] new_chain.remove(top_vol.volUUID) - self.assertEquals(image.Image.syncVolumeChain.actual_chain, - new_chain) + self.assertEqual(image.Image.syncVolumeChain.actual_chain, + new_chain)
self.assertEqual(base_vol.getLegality(), sc.LEGAL_VOL) diff --git a/tests/storage_misc_test.py b/tests/storage_misc_test.py index 7d80d47..81d690a 100644 --- a/tests/storage_misc_test.py +++ b/tests/storage_misc_test.py @@ -398,8 +398,8 @@ "/dev/zero", path, None, misc.MEGA, os.stat(path).st_size)
self.assertEqual(rc, 0) - self.assertEquals(os.stat(path).st_size, - misc.MEGA * 2 + len(add_data)) + self.assertEqual(os.stat(path).st_size, + misc.MEGA * 2 + len(add_data))
with open(path, "r") as f: for i in range(repetitions): diff --git a/tests/storage_resourcemanager_test.py b/tests/storage_resourcemanager_test.py index 2eb6e73..ffacf1f 100644 --- a/tests/storage_resourcemanager_test.py +++ b/tests/storage_resourcemanager_test.py @@ -471,19 +471,19 @@
@MonkeyPatch(rm, "_manager", manager()) def testResourceStatuses(self): - self.assertEquals(rm._getResourceStatus("storage", "resource"), - rm.LockState.free) + self.assertEqual(rm._getResourceStatus("storage", "resource"), + rm.LockState.free) exclusive1 = rm.acquireResource("storage", "resource", rm.EXCLUSIVE) - self.assertEquals(rm._getResourceStatus("storage", "resource"), - rm.LockState.locked) + self.assertEqual(rm._getResourceStatus("storage", "resource"), + rm.LockState.locked) exclusive1.release() shared1 = rm.acquireResource("storage", "resource", rm.SHARED) - self.assertEquals(rm._getResourceStatus("storage", "resource"), - rm.LockState.shared) + self.assertEqual(rm._getResourceStatus("storage", "resource"), + rm.LockState.shared) shared1.release() try: - self.assertEquals(rm._getResourceStatus("null", "resource"), - rm.LockState.free) + self.assertEqual(rm._getResourceStatus("null", "resource"), + rm.LockState.free) except KeyError: return
@@ -558,7 +558,7 @@
exclusiveReq2.cancel() self.assertTrue(exclusiveReq2.canceled()) - self.assertEquals(resources.pop(), None) # exclusiveReq 2 + self.assertEqual(resources.pop(), None) # exclusiveReq 2
resources.pop().release() # exclusiveReq 1
diff --git a/tests/storage_sd_manifest_test.py b/tests/storage_sd_manifest_test.py index 12af9f0..7523813 100644 --- a/tests/storage_sd_manifest_test.py +++ b/tests/storage_sd_manifest_test.py @@ -81,8 +81,8 @@ def test_getmetaparam(self): with fake_file_env() as env: sd_manifest = env.sd_manifest - self.assertEquals(sd_manifest.sdUUID, - sd_manifest.getMetaParam(sd.DMDK_SDUUID)) + self.assertEqual(sd_manifest.sdUUID, + sd_manifest.getMetaParam(sd.DMDK_SDUUID))
def test_getallimages(self): with fake_file_env() as env: @@ -120,8 +120,8 @@
def test_getmetaparam(self): with fake_block_env() as env: - self.assertEquals(env.sd_manifest.sdUUID, - env.sd_manifest.getMetaParam(sd.DMDK_SDUUID)) + self.assertEqual(env.sd_manifest.sdUUID, + env.sd_manifest.getMetaParam(sd.DMDK_SDUUID))
def test_getblocksize_defaults(self): with fake_block_env() as env: diff --git a/tests/storage_storageserver_test.py b/tests/storage_storageserver_test.py index 96e9f41..ce0a8e7 100644 --- a/tests/storage_storageserver_test.py +++ b/tests/storage_storageserver_test.py @@ -141,10 +141,10 @@
def test_mountpoint(self): mount_con = GlusterFSConnection("server:/volume", mountClass=FakeMount) - self.assertEquals(mount_con._mount.fs_spec, - "server:/volume") - self.assertEquals(mount_con._mount.fs_file, - "/tmp/glusterSD/server:_volume") + self.assertEqual(mount_con._mount.fs_spec, + "server:/volume") + self.assertEqual(mount_con._mount.fs_file, + "/tmp/glusterSD/server:_volume")
@MonkeyPatch(gluster_cli, 'exists', lambda: True) @MonkeyPatch(storageServer, 'supervdsm', FakeSupervdsm()) @@ -160,8 +160,8 @@ storageServer.supervdsm.glusterVolumeInfo = glusterVolumeInfo
gluster = GlusterFSConnection(spec="192.168.122.1:/music") - self.assertEquals(gluster.options, - "backup-volfile-servers=192.168.122.2:192.168.122.3") + self.assertEqual(gluster.options, + "backup-volfile-servers=192.168.122.2:192.168.122.3")
@MonkeyPatch(gluster_cli, 'exists', lambda: True) @MonkeyPatch(storageServer, 'supervdsm', FakeSupervdsm()) diff --git a/tests/tool_test.py b/tests/tool_test.py index 5cdef21..828f5ca 100644 --- a/tests/tool_test.py +++ b/tests/tool_test.py @@ -217,7 +217,7 @@ setattr(c, 'isconfigured', lambda: isconfigured) setattr(c, 'validate', lambda: isvalid) if isinstance(expected, bool): - self.assertEquals( + self.assertEqual( configurator._should_configure(c, force), expected ) @@ -418,7 +418,7 @@ ('LCONF', 'empty'), ('QCONF', 'empty'), ) - self.assertEquals( + self.assertEqual( libvirt.isconfigured(), NO ) diff --git a/tests/utils_test.py b/tests/utils_test.py index c9a23bd..edba990 100644 --- a/tests/utils_test.py +++ b/tests/utils_test.py @@ -311,8 +311,8 @@ try: cmd_args = utils.getCmdArgs(sproc.pid) # let's ignore optional taskset at the beginning - self.assertEquals(cmd_args[-len(args):], - tuple(args)) + self.assertEqual(cmd_args[-len(args):], + tuple(args)) finally: sproc.kill() sproc.wait() @@ -322,8 +322,8 @@ sproc = commands.execCmd(args, sync=False) sproc.kill() try: - test = lambda: self.assertEquals(utils.getCmdArgs(sproc.pid), - tuple()) + test = lambda: self.assertEqual(utils.getCmdArgs(sproc.pid), + tuple()) utils.retry(AssertionError, test, tries=10, sleep=0.1) finally: sproc.wait() @@ -686,8 +686,8 @@ try: proc = commands.execCmd((EXT_SLEEP, '30s'), sync=False)
- self.assertEquals(taskset.get(proc.pid), - taskset.get(os.getpid())) + self.assertEqual(taskset.get(proc.pid), + taskset.get(os.getpid())) finally: proc.kill()
diff --git a/tests/v2v_test.py b/tests/v2v_test.py index c34c69c..3506d32 100644 --- a/tests/v2v_test.py +++ b/tests/v2v_test.py @@ -498,8 +498,8 @@ def _assertVmDisksMatchSpec(self, vm, spec): disk = vm['disks'][0] self.assertEqual(disk['dev'], 'sda') - self.assertEquals(disk['alias'], - '[datastore1] RHEL/RHEL_%s.vmdk' % spec.name) + self.assertEqual(disk['alias'], + '[datastore1] RHEL/RHEL_%s.vmdk' % spec.name) self.assertIn('capacity', disk) self.assertIn('allocation', disk)
diff --git a/tests/vdsclient_test.py b/tests/vdsclient_test.py index 56856cb..3c0ec9a 100644 --- a/tests/vdsclient_test.py +++ b/tests/vdsclient_test.py @@ -434,38 +434,38 @@ def testPlainParseArgs(self): fixture = "key1=val1,key2=val2,key3=val3" args = vdsClient.parseArgs(fixture) - self.assertEquals(args, {'key1': 'val1', 'key2': 'val2', - 'key3': 'val3'}) + self.assertEqual(args, {'key1': 'val1', 'key2': 'val2', + 'key3': 'val3'})
def testQuotedParseArgs(self): fixture = "key1="val1",'key2'=val2,key3='val3'" args = vdsClient.parseArgs(fixture) - self.assertEquals(args, {'key1': 'val1', 'key2': 'val2', - 'key3': 'val3'}) + self.assertEqual(args, {'key1': 'val1', 'key2': 'val2', + 'key3': 'val3'})
def testQuotedCommasParseArgs(self): fixture = "key1=val1,"k,e,y,2"=val2,key3='v,a,l,3'" args = vdsClient.parseArgs(fixture) - self.assertEquals(args, {'key1': 'val1', 'k,e,y,2': 'val2', - 'key3': 'v,a,l,3'}) + self.assertEqual(args, {'key1': 'val1', 'k,e,y,2': 'val2', + 'key3': 'v,a,l,3'})
def testEscapedQuotesParseArgs(self): fixture = "k\'ey1=v\"al1,key2="va\"l2",key3=val3" args = vdsClient.parseArgs(fixture) - self.assertEquals(args, {'k'ey1': 'v"al1', 'key2': 'va"l2', - 'key3': 'val3'}) + self.assertEqual(args, {'k'ey1': 'v"al1', 'key2': 'va"l2', + 'key3': 'val3'})
def testEscapedCommasParseArgs(self): fixture = "key1=val1,key2=v\,al2,key3=val3" args = vdsClient.parseArgs(fixture) - self.assertEquals(args, {'key1': 'val1', 'key2': 'v,al2', - 'key3': 'val3'}) + self.assertEqual(args, {'key1': 'val1', 'key2': 'v,al2', + 'key3': 'val3'})
def testNoValueArgs(self): fixture = "key1=val1,key2=,key3=val3" args = vdsClient.parseArgs(fixture) - self.assertEquals(args, {'key1': 'val1', 'key2': '', - 'key3': 'val3'}) + self.assertEqual(args, {'key1': 'val1', 'key2': '', + 'key3': 'val3'})
@permutations([ ['', None], diff --git a/tests/vmmigration_test.py b/tests/vmmigration_test.py index 19246ce..f176ac5 100644 --- a/tests/vmmigration_test.py +++ b/tests/vmmigration_test.py @@ -149,8 +149,8 @@ def test_params_stored(self): with fake.VM() as testvm: with testvm.migration_parameters(self.params): - self.assertEquals(testvm.conf['_migrationParams'], - self.params) + self.assertEqual(testvm.conf['_migrationParams'], + self.params)
def test_params_removed(self): with fake.VM() as testvm: @@ -240,7 +240,7 @@ ]): with fake.VM(status=vm_status, cif=self.cif) as testvm: res = testvm.migrate({}) # no params needed - self.assertEquals( + self.assertEqual( response.is_error(res, error_code), is_error, )
From Dan Kenigsberg danken@redhat.com:
Dan Kenigsberg has posted comments on this change.
Change subject: tests: remove remaining assertEquals ......................................................................
Patch Set 1: Verified+1
gitpydiff HEAD~
shows that the change is only in assertEquals->assertEqual
vdsm-patches@lists.fedorahosted.org