image/fake: added teardown method
Unit tests may alter images in FakeImageService which has pre-defined images. Since some unit tests depend on those images, so it needs to be cleaned up after image alternation. Otherwise running many unit tests may fail.
This commit is contained in:
@@ -31,6 +31,7 @@ import unittest
|
||||
|
||||
import mox
|
||||
import nose.plugins.skip
|
||||
import nova.image.fake
|
||||
import shutil
|
||||
import stubout
|
||||
from eventlet import greenthread
|
||||
@@ -119,6 +120,9 @@ class TestCase(unittest.TestCase):
|
||||
if hasattr(fake.FakeConnection, '_instance'):
|
||||
del fake.FakeConnection._instance
|
||||
|
||||
if FLAGS.image_service == 'nova.image.fake.FakeImageService':
|
||||
nova.image.fake.FakeImageService_reset()
|
||||
|
||||
# Reset any overriden flags
|
||||
self.reset_flags()
|
||||
|
||||
|
Reference in New Issue
Block a user