From 36f81181f08c9f684fc67e3154ad43769170ff92 Mon Sep 17 00:00:00 2001 From: Ian McLeod Date: Wed, 2 Apr 2014 17:45:35 -0500 Subject: [PATCH] Slight modification of mock imports to make them work fix one test that failed to release the lock - this blocked the follow on tests --- tests/test_cacheManager.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/test_cacheManager.py b/tests/test_cacheManager.py index 7f79674..74b1f10 100644 --- a/tests/test_cacheManager.py +++ b/tests/test_cacheManager.py @@ -21,8 +21,9 @@ from tests.MockOS import MockOS # Force CacheManager to use MockStackEnvironment +sys.path.append("../") import MockStackEnvironment -sys.modules['StackEnvironment'] = sys.modules.pop('MockStackEnvironment') +sys.modules['StackEnvironment'] = sys.modules.pop('tests.MockStackEnvironment') sys.modules['StackEnvironment'].StackEnvironment = sys.modules['StackEnvironment'].MockStackEnvironment import StackEnvironment import novaimagebuilder.CacheManager @@ -49,6 +50,7 @@ def test_lock_and_get_index(self): self.cache_mgr.lock_and_get_index() self.assertIsNotNone(self.cache_mgr.index) self.assertIsInstance(self.cache_mgr.index, dict) + self.cache_mgr.unlock_index() def test_write_index_and_unlock(self): self.cache_mgr.lock_and_get_index() @@ -83,4 +85,4 @@ def test_retrieve_and_cache_object(self): del self.cache_mgr.index['%s-%s' % (self.os_dict['shortid'], self.install_config['arch'])] self.cache_mgr.write_index_and_unlock() except KeyError: - pass \ No newline at end of file + pass