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 <[email protected]> --- 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): -- To view, visit http://gerrit.ovirt.org/32726 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I0697923fb18eb0d7d35e8044da7f6b4f8ee9d051 Gerrit-PatchSet: 1 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Nir Soffer <[email protected]> _______________________________________________ vdsm-patches mailing list [email protected] https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches
