From: Royce Lv <lvroyce(a)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(a)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