Nir Soffer has posted comments on this change.

Change subject: tests: "-T src_cache" option in "qemu-img convert" command
......................................................................


Patch Set 1:

(5 comments)

http://gerrit.ovirt.org/#/c/36374/1/tests/qemuimgTests.py
File tests/qemuimgTests.py:

Line 181: 
Line 182:         with MonkeyPatchScope([(qemuimg, '_supports_src_cache',
Line 183:                               self.supported('convert', False))]):
Line 184:             with MonkeyPatchScope([(qemuimg, '_supports_qcow2_compat',
Line 185:                                   self.supported('convert', False))]):
No need to use nested MonkeyPatchScope - it accepts multiple patches.

Please convert this to:

    with MonkeyPatchScope([
        (qemuimg, '_supports_src_cache', self.supported('convert', False)),
        (qemuimg, '_supports_src_qcow2_format', self.supported('convert', 
False)),
        ]):
        code assuming both patches...
Line 186:                 with FakeCmd(utils, 'watchCmd', convert):
Line 187:                     qemuimg.convert('src', 'dst', True, 
dstFormat='qcow2')
Line 188: 
Line 189:     def test_qcow2_compat_supported(self):


Line 305:                               self.supported('convert', False))]):
Line 306:             with FakeCmd(utils, 'watchCmd', convert):
Line 307:                 qemuimg.convert('src', 'dst', True)
Line 308: 
Line 309:     def test_src_cache_compat(self, **kw):
Should be different test class - not related to convert
Line 310:         def call(cmd, **kw):
Line 311:             expected = [QEMU_IMG, '--help']
Line 312:             self.assertEqual(cmd, expected)
Line 313:             return 0, '', ''


Line 306:             with FakeCmd(utils, 'watchCmd', convert):
Line 307:                 qemuimg.convert('src', 'dst', True)
Line 308: 
Line 309:     def test_src_cache_compat(self, **kw):
Line 310:         def call(cmd, **kw):
Better move this to regular method reused by the different tests.
Line 311:             expected = [QEMU_IMG, '--help']
Line 312:             self.assertEqual(cmd, expected)
Line 313:             return 0, '', ''
Line 314: 


Line 315:         def supported(cmd, **kw):
Line 316:             return 0, '  compare [-f fmt] [-F fmt] [-T src_cache] 
...\n' \
Line 317:                       '  convert [-c] [-p] [-q] [-n] [-f fmt] [-t 
cache] ' \
Line 318:                       '[-T src_cache] [-O output_fmt] ...\n' \
Line 319:                       '  info [-f fmt] [--output=ofmt] ...\n', ''
Better have separate test for supported and unsupported.
Line 320: 
Line 321:         def unsupported(cmd, **kw):
Line 322:             return 0, '  compare [-f fmt] [-F fmt] ...\n' \
Line 323:                       '  convert [-c] [-p] [-q] [-n] [-f fmt] [-t 
cache] ' \


Line 324:                       '[-O output_fmt] ...\n' \
Line 325:                       '  info [-f fmt] [--output=ofmt] ...\n', ''
Line 326: 
Line 327:         with FakeCmd(utils, 'execCmd', call):
Line 328:             qemuimg._supports_src_cache('convert')
This can also be different test
Line 329: 
Line 330:         with FakeCmd(utils, 'execCmd', supported):
Line 331:             self.assertTrue(qemuimg._supports_src_cache('convert'))
Line 332: 


-- 
To view, visit http://gerrit.ovirt.org/36374
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: Ie385dda479424dee147d0a917388b662dbb0cecd
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Amador Pahim <[email protected]>
Gerrit-Reviewer: Nir Soffer <[email protected]>
Gerrit-Reviewer: [email protected]
Gerrit-Reviewer: oVirt Jenkins CI Server
Gerrit-HasComments: Yes
_______________________________________________
vdsm-patches mailing list
[email protected]
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches

Reply via email to