Change in vdsm[master]: oopTests: Use monkeypatch for changing idle time

ykaplan at redhat.com ykaplan at redhat.com
Mon Dec 22 12:22:33 UTC 2014


Yeela Kaplan has uploaded a new change for review.

Change subject: oopTests: Use monkeypatch for changing idle time
......................................................................

oopTests: Use monkeypatch for changing idle time

Change-Id: I66038dc301bc964e8d97f16ed39d4f1ec57a6dca
Signed-off-by: Yeela Kaplan <ykaplan at redhat.com>
---
M tests/outOfProcessTests.py
1 file changed, 3 insertions(+), 5 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/37/36337/1

diff --git a/tests/outOfProcessTests.py b/tests/outOfProcessTests.py
index 92a3dc9..ab78a99 100644
--- a/tests/outOfProcessTests.py
+++ b/tests/outOfProcessTests.py
@@ -21,6 +21,8 @@
 from testlib import VdsmTestCase as TestCaseBase
 import storage.outOfProcess as oop
 from vdsm import utils
+from monkeypatch import MonkeyPatchScope
+
 from functools import partial
 import gc
 import logging
@@ -64,10 +66,8 @@
         self.assertNotEquals(pids[0], pids[1])
 
     def testAmountOfInstancesPerPoolName(self):
-        idle = oop.IOPROC_IDLE_TIME
         MAXSLEEP = 30
-        try:
-            oop.IOPROC_IDLE_TIME = 5
+        with MonkeyPatchScope([(oop, 'IOPROC_IDLE_TIME', 5)]):
             poolA = "A"
             poolB = "B"
             wrapper = ref(oop.getProcessPool(poolA))
@@ -89,8 +89,6 @@
                 logging.info(refs)
                 logging.info(gc.get_referrers(*refs))
                 raise
-        finally:
-            oop.IOPROC_IDLE_TIME = idle
 
     def testEcho(self):
         data = """Censorship always defeats it own purpose, for it creates in


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I66038dc301bc964e8d97f16ed39d4f1ec57a6dca
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Yeela Kaplan <ykaplan at redhat.com>


More information about the vdsm-patches mailing list