[Kimchi-devel] [PATCHv2 2/2] Hack test_model to support vm model singleton

lvroyce at linux.vnet.ibm.com lvroyce at linux.vnet.ibm.com
Wed Mar 5 08:14:52 UTC 2014


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

Because test_model have singleton import for its whole life cycle,
the dict of singleton class not cleared even though instance deleted.
Hack it so that model instance can be generated again.

Signed-off-by: Royce Lv <lvroyce at linux.vnet.ibm.com>
---
 tests/test_model.py | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/tests/test_model.py b/tests/test_model.py
index 9df4994..cb24b0e 100644
--- a/tests/test_model.py
+++ b/tests/test_model.py
@@ -33,6 +33,7 @@ import iso_gen
 import kimchi.objectstore
 import utils
 from kimchi import netinfo
+from kimchi.basemodel import Singleton
 from kimchi.exception import InvalidOperation, InvalidParameter
 from kimchi.exception import NotFoundError, OperationFailed
 from kimchi.iscsi import TargetClient
@@ -46,6 +47,7 @@ class ModelTests(unittest.TestCase):
         self.tmp_store = '/tmp/kimchi-store-test'
 
     def tearDown(self):
+        Singleton._instances = {}
         os.unlink(self.tmp_store)
 
     def test_vm_info(self):
-- 
1.8.1.2




More information about the Kimchi-devel mailing list