Skip to content

Instantly share code, notes, and snippets.

@claudep
Created November 23, 2013 16:34
Show Gist options
  • Save claudep/7616757 to your computer and use it in GitHub Desktop.
Save claudep/7616757 to your computer and use it in GitHub Desktop.
def test_connection_import_doesnt_configure_settings(self):
"""
Test that importing django.db doesn't trigger settings configuration.
"""
from django.conf import settings
from django.utils.functional import empty
old_wrapped = settings._wrapped
settings._wrapped = empty
try:
self.assertFalse(settings.configured)
from django import db
reload(db)
self.assertFalse(settings.configured)
finally:
settings._wrapped = old_wrapped
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment