[Kimchi-devel] [PATCH v5 2/7] Fix mockmodel reset for objectstore

Crístian Viana vianac at linux.vnet.ibm.com
Fri Sep 5 16:44:51 UTC 2014


From: Royce Lv <lvroyce at linux.vnet.ibm.com>

In mockmodel reset, we only reset model fields dict
but objectstore remains unchanged,
tasks retained in objecstore making mockmodel task related tests fail.
Reset objectstore to fix this.

Signed-off-by: Royce Lv <lvroyce at linux.vnet.ibm.com>
---
 src/kimchi/mockmodel.py | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/kimchi/mockmodel.py b/src/kimchi/mockmodel.py
index 908b0b7..41e001c 100644
--- a/src/kimchi/mockmodel.py
+++ b/src/kimchi/mockmodel.py
@@ -64,6 +64,7 @@ class MockModel(object):
     def __init__(self, objstore_loc=None):
         self.reset()
         self.objstore = ObjectStore(objstore_loc)
+        self.objstore_loc = objstore_loc
         self.distros = self._get_distros()
 
     def capabilities_lookup(self, *ident):
@@ -78,6 +79,8 @@ class MockModel(object):
                 'federation': 'off'}
 
     def reset(self):
+        if hasattr(self, 'objstore'):
+            self.objstore = ObjectStore(self.objstore_loc)
         self._mock_vms = {}
         self._mock_screenshots = {}
         self._mock_templates = {}
-- 
1.9.3




More information about the Kimchi-devel mailing list