Change in vdsm[master]: test: Use mock module for testing

sbonazzo at redhat.com sbonazzo at redhat.com
Wed Apr 13 10:46:36 UTC 2016


Sandro Bonazzola has posted comments on this change.

Change subject: test: Use mock module for testing
......................................................................


Patch Set 7:

(2 comments)

https://gerrit.ovirt.org/#/c/55342/7/tests/network/netswitch_test.py
File tests/network/netswitch_test.py:

Line 23: from nose.plugins.attrib import attr
Line 24: 
Line 25: from vdsm.network import netswitch
Line 26: 
Line 27: from testlib import mock
why do indirect import?
just replace above with:

 try:
     from unittest import mock
 except ImportError:  # py2
     import mock
Line 28: from testlib import VdsmTestCase
Line 29: 
Line 30: 
Line 31: @attr(type='unit')


https://gerrit.ovirt.org/#/c/55342/7/tests/testlib.py
File tests/testlib.py:

Line 38: try:
Line 39:     from unittest import mock
Line 40: except ImportError:  # py2
Line 41:     import mock
Line 42: mock
why do you import mock here if it's not needed?
Line 43: 
Line 44: from nose import config
Line 45: from nose import core
Line 46: from nose import result


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

Gerrit-MessageType: comment
Gerrit-Change-Id: I1c0af7baab7c35a2617bd60a62a0b1534e5f8894
Gerrit-PatchSet: 7
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Edward Haas <edwardh at redhat.com>
Gerrit-Reviewer: Dan Kenigsberg <danken at redhat.com>
Gerrit-Reviewer: Edward Haas <edwardh at redhat.com>
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Nir Soffer <nsoffer at redhat.com>
Gerrit-Reviewer: Ondřej Svoboda <osvoboda at redhat.com>
Gerrit-Reviewer: Petr Horáček <phoracek at redhat.com>
Gerrit-Reviewer: Piotr Kliczewski <piotr.kliczewski at gmail.com>
Gerrit-Reviewer: Sandro Bonazzola <sbonazzo at redhat.com>
Gerrit-Reviewer: Yaniv Bronhaim <ybronhei at redhat.com>
Gerrit-Reviewer: gerrit-hooks <automation at ovirt.org>
Gerrit-HasComments: Yes


More information about the vdsm-patches mailing list