mirror of
https://github.com/django/django.git
synced 2025-07-04 17:59:13 +00:00
rewrite app globbing doctest to unittest
git-svn-id: http://code.djangoproject.com/svn/django/branches/soc2010/app-loading@13387 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
ff3c1c6e3a
commit
2b50fd810a
@ -7,26 +7,25 @@ from unittest import TestCase
|
||||
from django.conf import Settings
|
||||
from django.db.models.loading import cache, load_app
|
||||
|
||||
__test__ = {"API_TESTS": """
|
||||
Test the globbing of INSTALLED_APPS.
|
||||
class InstalledAppsGlobbingTest(TestCase):
|
||||
|
||||
>>> old_sys_path = sys.path
|
||||
>>> sys.path.append(os.path.dirname(os.path.abspath(__file__)))
|
||||
def setUp(self):
|
||||
self.old_path = sys.path
|
||||
sys.path.append(os.path.dirname(os.path.abspath(__file__)))
|
||||
self.old_tz = os.environ.get("TZ")
|
||||
self.settings = Settings('test_settings')
|
||||
|
||||
>>> old_tz = os.environ.get("TZ")
|
||||
>>> settings = Settings('test_settings')
|
||||
def tearDown(self):
|
||||
sys.path = self.old_path
|
||||
# Undo a side-effect of installing a new settings object.
|
||||
if hasattr(time, "tzset") and self.old_tz:
|
||||
os.environ["TZ"] = self.old_tz
|
||||
time.tzset()
|
||||
|
||||
>>> settings.INSTALLED_APPS
|
||||
['parent.app', 'parent.app1', 'parent.app_2']
|
||||
|
||||
>>> sys.path = old_sys_path
|
||||
|
||||
# Undo a side-effect of installing a new settings object.
|
||||
>>> if hasattr(time, "tzset") and old_tz:
|
||||
... os.environ["TZ"] = old_tz
|
||||
... time.tzset()
|
||||
|
||||
"""}
|
||||
def test_globbing(self):
|
||||
"""Test the globbing of INSTALLED_APPS"""
|
||||
self.assertEqual(self.settings.INSTALLED_APPS,
|
||||
['parent.app', 'parent.app1', 'parent.app_2'])
|
||||
|
||||
class EggLoadingTest(TestCase):
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user