Nir Soffer has uploaded a new change for review.
Change subject: tests: Use more clear name ......................................................................
tests: Use more clear name
false_mock is misterious name, specially when used as false_mock=False. Reading the code reveal that false_mock=True means that the mock should fail. Hopefully renming it to should_fail will make this more clear.
When creating a mock, using optional argument notation "should_fail=True" is more clear then just "True".
Change-Id: I0697923fb18eb0d7d35e8044da7f6b4f8ee9d051 Signed-off-by: Nir Soffer nsoffer@redhat.com --- M tests/toolTests.py 1 file changed, 8 insertions(+), 8 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/26/32726/1
diff --git a/tests/toolTests.py b/tests/toolTests.py index e01ed24..be0f55b 100644 --- a/tests/toolTests.py +++ b/tests/toolTests.py @@ -43,10 +43,10 @@
class MockModuleConfigurator(ModuleConfigure):
- def __init__(self, name, requires, false_mock=False): + def __init__(self, name, requires, should_fail=False): self._name = name self._requires = requires - self._false_mock = false_mock + self._should_fail = should_fail
@property def name(self): @@ -60,22 +60,22 @@ return "name: %s, requires: %s" % (self._name, self._requires)
def validate(self): - if self._false_mock: + if self._should_fail: return False print 'valid' return True
def isconfigured(self): - if self._false_mock: + if self._should_fail: return NOT_CONFIGURED return CONFIGURED
def configure(self): - if self._false_mock: + if self._should_fail: raise InvalidRun('mock for invalid configure')
def removeConf(self): - if self._false_mock: + if self._should_fail: raise Exception('mock invalid remove conf')
@@ -191,8 +191,8 @@ configurator, '_CONFIGURATORS', { - 'a': MockModuleConfigurator('a', set(), True), - 'b': MockModuleConfigurator('b', set(), True), + 'a': MockModuleConfigurator('a', set(), should_fail=True), + 'b': MockModuleConfigurator('b', set(), should_fail=True), } ) def testFailuresOnExposedFuncs(self):
Nir Soffer has posted comments on this change.
Change subject: tests: Use more clear name ......................................................................
Patch Set 1: Verified+1
oVirt Jenkins CI Server has posted comments on this change.
Change subject: tests: Use more clear name ......................................................................
Patch Set 1:
Build Successful
http://jenkins.ovirt.org/job/vdsm_master_unit_tests_gerrit_el/11436/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_master_unit-tests_created/12380/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_master_pep8_gerrit/12225/ : SUCCESS
Yaniv Bronhaim has posted comments on this change.
Change subject: tests: Use more clear name ......................................................................
Patch Set 1: Code-Review+1
mooli tayer has posted comments on this change.
Change subject: tests: Use more clear name ......................................................................
Patch Set 1: Code-Review+1
Dan Kenigsberg has posted comments on this change.
Change subject: tests: Use more clear name ......................................................................
Patch Set 1: Code-Review+2
Nir Soffer has posted comments on this change.
Change subject: tests: Use more clear name ......................................................................
Patch Set 2:
Rebase, no code change
Nir Soffer has posted comments on this change.
Change subject: tests: Use more clear name ......................................................................
Patch Set 2: Verified+1
oVirt Jenkins CI Server has posted comments on this change.
Change subject: tests: Use more clear name ......................................................................
Patch Set 2:
Build Successful
http://jenkins.ovirt.org/job/vdsm_master_unit_tests_gerrit_el/11518/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_master_unit-tests_created/12462/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_master_pep8_gerrit/12307/ : SUCCESS
mooli tayer has posted comments on this change.
Change subject: tests: Use more clear name ......................................................................
Patch Set 2: Code-Review+1
Allon Mureinik has posted comments on this change.
Change subject: tests: Use more clear name ......................................................................
Patch Set 2: Code-Review+1
Dan Kenigsberg has posted comments on this change.
Change subject: tests: Use more clear name ......................................................................
Patch Set 2: Code-Review+2
Dan Kenigsberg has submitted this change and it was merged.
Change subject: tests: Use more clear name ......................................................................
tests: Use more clear name
false_mock is misterious name, specially when used as false_mock=False. Reading the code reveal that false_mock=True means that the mock should fail. Hopefully renming it to should_fail will make this more clear.
When creating a mock, using optional argument notation "should_fail=True" is more clear then just "True".
Change-Id: I0697923fb18eb0d7d35e8044da7f6b4f8ee9d051 Signed-off-by: Nir Soffer nsoffer@redhat.com Reviewed-on: http://gerrit.ovirt.org/32726 Reviewed-by: mooli tayer mtayer@redhat.com Reviewed-by: Allon Mureinik amureini@redhat.com Reviewed-by: Dan Kenigsberg danken@redhat.com --- M tests/toolTests.py 1 file changed, 8 insertions(+), 8 deletions(-)
Approvals: Nir Soffer: Verified mooli tayer: Looks good to me, but someone else must approve Allon Mureinik: Looks good to me, but someone else must approve Dan Kenigsberg: Looks good to me, approved
oVirt Jenkins CI Server has posted comments on this change.
Change subject: tests: Use more clear name ......................................................................
Patch Set 3:
Build Failed
http://jenkins.ovirt.org/job/vdsm_master_create-rpms_merged/1855/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_master_create-rpms_merged_test_debug/196/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_master_verify-error-codes_merged/5829/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_master_unit-tests_merged/3988/ : FAILURE
vdsm-patches@lists.fedorahosted.org