]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
test_volume unittest fails if ran only this module
authorPranali Deore <pranali.deore@nttdata.com>
Mon, 17 Feb 2014 09:35:34 +0000 (01:35 -0800)
committerPranali Deore <pranali.deore@nttdata.com>
Mon, 17 Feb 2014 09:53:42 +0000 (01:53 -0800)
Using stevedore ExtensionManager to load entry_points(extensions)
before running any test case.

In BaseVolumeTestCase we have stubbed 'os.path.exists' call,
because of this stevedore is not able to load entry points paroperly.
Stevedore internally use pkg_resources and pkg_resources use
'os.path.exists' to check if entry_points.txt file exists or not.
Because of stubbibg it is returning True even if file do not exists.

Change-Id: I4fd6bee2e9f33c45ad3deacfe7359dc56171205e
Closes-Bug: #1263175

cinder/tests/test_volume.py

index 5c7b71a8f7f2e960fd57dfa6f069a6c9fcce2691..9c576c0086c49735e89665f5802f7e6866586989 100644 (file)
@@ -29,6 +29,7 @@ import eventlet
 import mock
 import mox
 from oslo.config import cfg
+from stevedore import extension
 from taskflow.engines.action_engine import engine
 
 from cinder.backup import driver as backup_driver
@@ -90,6 +91,8 @@ class BaseVolumeTestCase(test.TestCase):
     """Test Case for volumes."""
     def setUp(self):
         super(BaseVolumeTestCase, self).setUp()
+        self.extension_manager = extension.ExtensionManager(
+            "BaseVolumeTestCase")
         vol_tmpdir = tempfile.mkdtemp()
         self.flags(volumes_dir=vol_tmpdir,
                    notification_driver=[test_notifier.__name__])