[Kimchi-devel] [PATCHv2 2/2] Hack test_model to support vm model singleton
Shu Ming
shuming at linux.vnet.ibm.com
Wed Mar 5 15:47:32 UTC 2014
Reviewed-by: Shu Ming <shuming at linux.vnet.ibm.com>
2014/3/5 16:14, lvroyce at linux.vnet.ibm.com:
> 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):
More information about the Kimchi-devel
mailing list