From 085e4c9112600b84cef601bc331cafae03c1b1c9 Mon Sep 17 00:00:00 2001 From: Alex Gaynor Date: Thu, 21 Oct 2010 17:37:19 +0000 Subject: [PATCH] Ensure the mutliple_database tests leave the settings in the same state they found them. git-svn-id: http://code.djangoproject.com/svn/django/trunk@14313 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- tests/regressiontests/multiple_database/tests.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tests/regressiontests/multiple_database/tests.py b/tests/regressiontests/multiple_database/tests.py index c688a8c64e..e5e9ff20fc 100644 --- a/tests/regressiontests/multiple_database/tests.py +++ b/tests/regressiontests/multiple_database/tests.py @@ -1548,13 +1548,17 @@ class AuthTestCase(TestCase): command_output = new_io.getvalue().strip() self.assertTrue('"email": "alice@example.com",' in command_output) +_missing = object() class UserProfileTestCase(TestCase): def setUp(self): - self.old_auth_profile_module = getattr(settings, 'AUTH_PROFILE_MODULE', None) + self.old_auth_profile_module = getattr(settings, 'AUTH_PROFILE_MODULE', _missing) settings.AUTH_PROFILE_MODULE = 'multiple_database.UserProfile' def tearDown(self): - settings.AUTH_PROFILE_MODULE = self.old_auth_profile_module + if self.old_auth_profile_module is _missing: + del settings.AUTH_PROFILE_MODULE + else: + settings.AUTH_PROFILE_MODULE = self.old_auth_profile_module def test_user_profiles(self):