Change in vdsm[master]: v2v: add test testSuccessfulImportOVA

nsoffer at redhat.com nsoffer at redhat.com
Wed Dec 16 10:37:18 UTC 2015


Nir Soffer has posted comments on this change.

Change subject: v2v: add test testSuccessfulImportOVA
......................................................................


Patch Set 1:

(2 comments)

https://gerrit.ovirt.org/#/c/50585/1/tests/v2vTests.py
File tests/v2vTests.py:

Line 359: 
Line 360:         self.assertEqual(ivm.status, v2v.STATUS.DONE)
Line 361: 
Line 362:     @contextmanager
Line 363:     def temporary_ovf_dir(self):
Better keep this in the module, as you don't need any of the state of this class. That way this is a reusable utility that can be used by many test classes - like the password_file context manager in v2v.py.
Line 364:         with namedTemporaryDir() as base:
Line 365:             ovfpath = os.path.join(base, 'testvm.ovf')
Line 366:             ovapath = os.path.join(base, 'testvm.ova')
Line 367:             ovf = read_ovf('test')


Line 370:                 ovffile.write(ovf)
Line 371:             yield ovapath
Line 372: 
Line 373:     @MonkeyPatch(v2v, '_VIRT_V2V', FAKE_VIRT_V2V)
Line 374:     @MonkeyPatch(v2v, '_V2V_DIR', tempfile.mkdtemp())
You are creating a temporary directory but never delete it. Since you are not using this directory, you don't need to mock it.
Line 375:     def testSuccessfulImportOVA(self):
Line 376:         with self.temporary_ovf_dir() as ovapath:
Line 377:             command = v2v.OvaCommand(self.url,
Line 378:                                      ovapath,


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

Gerrit-MessageType: comment
Gerrit-Change-Id: I465d68e5f42f6f5829d33bf62c2d40412a8aead4
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Shahar Havivi <shavivi at redhat.com>
Gerrit-Reviewer: Francesco Romani <fromani at redhat.com>
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Nir Soffer <nsoffer at redhat.com>
Gerrit-Reviewer: Shahar Havivi <shavivi at redhat.com>
Gerrit-Reviewer: gerrit-hooks <automation at ovirt.org>
Gerrit-HasComments: Yes


More information about the vdsm-patches mailing list