summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--nova/test.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/nova/test.py b/nova/test.py
index 85ba990c0..a8af00889 100644
--- a/nova/test.py
+++ b/nova/test.py
@@ -26,6 +26,7 @@ inline callbacks.
import eventlet
eventlet.monkey_patch(os=False)
+import copy
import os
import shutil
import sys
@@ -234,8 +235,12 @@ class TestCase(testtools.TestCase):
self.useFixture(_DB_CACHE)
# NOTE(danms): Make sure to reset us back to non-remote objects
- # for each test to avoid interactions.
+ # for each test to avoid interactions. Also, backup the object
+ # registry.
objects_base.NovaObject.indirection_api = None
+ self._base_test_obj_backup = copy.copy(
+ objects_base.NovaObject._obj_classes)
+ self.addCleanup(self._restore_obj_registry)
mox_fixture = self.useFixture(MoxStubout())
self.mox = mox_fixture.mox
@@ -246,6 +251,9 @@ class TestCase(testtools.TestCase):
CONF.set_override('fatal_exception_format_errors', True)
CONF.set_override('enabled', True, 'osapi_v3')
+ def _restore_obj_registry(self):
+ objects_base.NovaObject._obj_classes = self._base_test_obj_backup
+
def _clear_attrs(self):
# Delete attributes that don't start with _ so they don't pin
# memory around unnecessarily for the duration of the test