Change in vdsm[master]: v2v: refactor testSuccessfulImport test

nsoffer at redhat.com nsoffer at redhat.com
Wed Dec 23 13:32:47 UTC 2015


Nir Soffer has posted comments on this change.

Change subject: v2v: refactor testSuccessfulImport test
......................................................................


Patch Set 2:

(1 comment)

https://gerrit.ovirt.org/#/c/50584/2/tests/v2vTests.py
File tests/v2vTests.py:

Line 321:         self.assertEquals(network['macAddr'], _mac_from_uuid(spec.vmid))
Line 322:         self.assertEquals(network['bridge'], 'VM Network')
Line 323: 
Line 324:     @MonkeyPatch(v2v, '_VIRT_V2V', FAKE_VIRT_V2V)
Line 325:     @MonkeyPatch(v2v, '_V2V_DIR', tempfile.mkdtemp())
> sorry I don't remember seeing that.
No, but you can do this:

    @MonkeyPatch(v2v, '_V2V_DIR', None)
    def test_foo(self):
        with namedTemporaryDir() as v2v._V2V_DIR:
            ...

Monkeypatching will ensure that the original value is restored after the test, and you set the value to a temporary directory that the test creates and deletes.
Line 326:     def testSuccessfulVMWareImport(self):
Line 327:         v2v.convert_external_vm(self.url,
Line 328:                                 'root',
Line 329:                                 ProtectedPassword('mypassword'),


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

Gerrit-MessageType: comment
Gerrit-Change-Id: I30144a9f03d1d95837f43d8b5575aae1499d3c2a
Gerrit-PatchSet: 2
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