Change in vdsm[master]: utilsTests: Avoiding returning in the middle of the method

vvolansk at redhat.com vvolansk at redhat.com
Wed Jan 1 13:40:18 UTC 2014


Vered Volansky has uploaded a new change for review.

Change subject: utilsTests: Avoiding returning in the middle of the method
......................................................................

utilsTests: Avoiding returning in the middle of the method

In RollbackContextTest there are some tests which returns in the first
except. This patch avoids that.

Change-Id: I877f65569f4304bdd4160bb9f84facf261e568e8
Signed-off-by: Vered Volansky <vvolansk at redhat.com>
---
M tests/utilsTests.py
1 file changed, 7 insertions(+), 9 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/86/22886/1

diff --git a/tests/utilsTests.py b/tests/utilsTests.py
index bf27f30..7ce15dc 100644
--- a/tests/utilsTests.py
+++ b/tests/utilsTests.py
@@ -334,9 +334,8 @@
                 rollback.prependDefer(self._callDef)
         except Exception:
             self.assertEquals(self._called, 2)
-            return
-
-        self.fail("Exception was not raised")
+        else:
+            self.fail("Exception was not raised")
 
     def testFirstException(self):
         """
@@ -353,11 +352,10 @@
                 rollback.prependDefer(self._callDef)
         except RuntimeError:
             self.assertEquals(self._called, 3)
-            return
         except Exception:
             self.fail("Wrong exception was raised")
-
-        self.fail("Exception was not raised")
+        else:
+            self.fail("Exception was not raised")
 
     def testKeyErrorException(self):
         """
@@ -368,8 +366,8 @@
             with utils.RollbackContext():
                 {}['aKey']
         except KeyError:
-            return
+            pass
         except Exception:
             self.fail("Wrong exception was raised")
-
-        self.fail("Exception was not raised")
+        else:
+            self.fail("Exception was not raised")


-- 
To view, visit http://gerrit.ovirt.org/22886
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I877f65569f4304bdd4160bb9f84facf261e568e8
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Vered Volansky <vvolansk at redhat.com>


More information about the vdsm-patches mailing list