Change in vdsm[master]: tests: virt: modernize vm* tests

fromani at redhat.com fromani at redhat.com
Mon Feb 29 08:23:13 UTC 2016


Francesco Romani has posted comments on this change.

Change subject: tests: virt: modernize vm* tests
......................................................................


Patch Set 2:

(6 comments)

https://gerrit.ovirt.org/#/c/54022/2/tests/vmApiTests.py
File tests/vmApiTests.py:

Line 51: list
> no need to have a list here! I believe it's a python-modernize bug
Done


https://gerrit.ovirt.org/#/c/54022/2/tests/vmOperationsTests.py
File tests/vmOperationsTests.py:

Line 343:         self._offset = offset
Line 344:         self._params = {}
Line 345: 
Line 346:     def setSchedulerParameters(self, params):
Line 347:         for k, v in list(params.items()):
> ditto
Done
Line 348:             self._params[k] = int(v) + self._offset
Line 349: 
Line 350:     def schedulerParameters(self):
Line 351:         return self._params


https://gerrit.ovirt.org/#/c/54022/2/tests/vmStatsTests.py
File tests/vmStatsTests.py:

Line 234: self.samples = list(_FAKE_BULK_STATS.values())[0]
> self.samples = list(_FAKE_BULK_STATS.values())[0]
see below, which seems to apply also here


Line 284: 
Line 285:     def test_network_missing(self):
Line 286:         # seen using SR-IOV
Line 287: 
Line 288:         bulk_stats = list(_FAKE_BULK_STATS_SRIOV.values())[0]
> next(six.itervalues(_FAKE_BULK_STATS_SRIOV)) would be a bit nicer.
It would be nicer, but:

1002 09:22:06 fromani at musashi ~ $ python
Python 2.7.10 (default, Sep  8 2015, 17:20:17) 
[GCC 5.1.1 20150618 (Red Hat 5.1.1-4)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> x = [0,1,2,3]
>>> print(next(x))
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: list object is not an iterator
>>>
Line 289:         indexes = vmstats._find_bulk_stats_reverse_map(
Line 290:             bulk_stats[0], 'net')
Line 291:         self.assertTrue(indexes)
Line 292: 


https://gerrit.ovirt.org/#/c/54022/2/tests/vmTests.py
File tests/vmTests.py:

Line 64: from testValidation import slowtest
Line 65: from vmTestsData import CONF_TO_DOMXML_X86_64
Line 66: from vmTestsData import CONF_TO_DOMXML_PPC64
Line 67: import vmfakelib as fake
Line 68: import six
> please import far above
Done
Line 69: from six.moves import zip
Line 70: 
Line 71: 
Line 72: _VM_PARAMS = {


https://gerrit.ovirt.org/#/c/54022/2/tests/vmfakelib.py
File tests/vmfakelib.py:

Line 64:             sec.usage_type = usage_type
Line 65:             sec.description = description
Line 66:         else:
Line 67:             # (usage_type, usage_id) pair must be unique
Line 68:             for sec in list(self.secrets.values()):
> no need for list() call here.
Done
Line 69:                 if sec.usage_type == usage_type and sec.usage_id == usage_id:
Line 70:                     raise Error(libvirt.VIR_ERR_INTERNAL_ERROR)
Line 71:             sec = Secret(self, uuid, usage_type, usage_id, description)
Line 72:             self.secrets[uuid] = sec


-- 
To view, visit https://gerrit.ovirt.org/54022
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: Ie9324ef9d17df148ea38a03771b896132ec02e22
Gerrit-PatchSet: 2
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Francesco Romani <fromani at redhat.com>
Gerrit-Reviewer: Dan Kenigsberg <danken at redhat.com>
Gerrit-Reviewer: Francesco Romani <fromani at redhat.com>
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: gerrit-hooks <automation at ovirt.org>
Gerrit-HasComments: Yes


More information about the vdsm-patches mailing list