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.conf import Settings
|
||||||
from django.db.models.loading import cache, load_app
|
from django.db.models.loading import cache, load_app
|
||||||
|
|
||||||
__test__ = {"API_TESTS": """
|
class InstalledAppsGlobbingTest(TestCase):
|
||||||
Test the globbing of INSTALLED_APPS.
|
|
||||||
|
|
||||||
>>> old_sys_path = sys.path
|
def setUp(self):
|
||||||
>>> sys.path.append(os.path.dirname(os.path.abspath(__file__)))
|
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")
|
def tearDown(self):
|
||||||
>>> settings = Settings('test_settings')
|
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
|
def test_globbing(self):
|
||||||
['parent.app', 'parent.app1', 'parent.app_2']
|
"""Test the globbing of INSTALLED_APPS"""
|
||||||
|
self.assertEqual(self.settings.INSTALLED_APPS,
|
||||||
>>> sys.path = old_sys_path
|
['parent.app', 'parent.app1', 'parent.app_2'])
|
||||||
|
|
||||||
# Undo a side-effect of installing a new settings object.
|
|
||||||
>>> if hasattr(time, "tzset") and old_tz:
|
|
||||||
... os.environ["TZ"] = old_tz
|
|
||||||
... time.tzset()
|
|
||||||
|
|
||||||
"""}
|
|
||||||
|
|
||||||
class EggLoadingTest(TestCase):
|
class EggLoadingTest(TestCase):
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user