From 13a485076f22b10921dda2e418c2345037e17b17 Mon Sep 17 00:00:00 2001 From: Calen Pennington Date: Thu, 11 Apr 2013 15:00:12 -0400 Subject: [PATCH] Properly save and restore settings.MODULESTORE, and clear at django._MODULESTORES at the end of the test --- .../xmodule/modulestore/tests/django_utils.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/common/lib/xmodule/xmodule/modulestore/tests/django_utils.py b/common/lib/xmodule/xmodule/modulestore/tests/django_utils.py index 7cbc591ff5..4f8d7b773c 100644 --- a/common/lib/xmodule/xmodule/modulestore/tests/django_utils.py +++ b/common/lib/xmodule/xmodule/modulestore/tests/django_utils.py @@ -52,15 +52,13 @@ class ModuleStoreTestCase(TestCase): # Use a uuid to differentiate # the mongo collections on jenkins. cls.orig_modulestore = copy.deepcopy(settings.MODULESTORE) - test_modulestore = cls.orig_modulestore - if 'direct' not in test_modulestore: - test_modulestore['direct'] = test_modulestore['default'] + if 'direct' not in settings.MODULESTORE: + settings.MODULESTORE['direct'] = settings.MODULESTORE['default'] - test_modulestore['default']['OPTIONS']['collection'] = 'modulestore_%s' % uuid4().hex - test_modulestore['direct']['OPTIONS']['collection'] = 'modulestore_%s' % uuid4().hex - xmodule.modulestore.django._MODULESTORES = {} + settings.MODULESTORE['default']['OPTIONS']['collection'] = 'modulestore_%s' % uuid4().hex + settings.MODULESTORE['direct']['OPTIONS']['collection'] = 'modulestore_%s' % uuid4().hex + xmodule.modulestore.django._MODULESTORES.clear() - settings.MODULESTORE = test_modulestore print settings.MODULESTORE TestCase.setUpClass() @@ -75,6 +73,8 @@ class ModuleStoreTestCase(TestCase): modulestore = xmodule.modulestore.django.modulestore() modulestore.collection.drop() + xmodule.modulestore.django._MODULESTORES.clear() + # Restore the original modulestore settings settings.MODULESTORE = cls.orig_modulestore