8000 rewrite app globbing doctest to unittest · alex-python/django@2b50fd8 · GitHub
[go: up one dir, main page]

Skip to content {"props":{"docsUrl":"https://docs.github.com/get-started/accessibility/keyboard-shortcuts"}}

Commit 2b50fd8

Browse files
committed
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
1 parent ff3c1c6 commit 2b50fd8

File tree

1 file changed

+17
-18
lines changed
  • tests/regressiontests/app_loading

1 file changed

+17
-18
lines changed

tests/regressiontests/app_loading/tests.py

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -7,26 +7,25 @@
77
from django.conf import Settings
88
from django.db.models.loading import cache, load_app
99

10-
__test__ = {"API_TESTS": """
11-
Test the globbing of INSTALLED_APPS.
10+
class InstalledAppsGlobbingTest(TestCase):
1211

13-
>>> old_sys_path = sys.path
14-
>>> sys.path.append(os.path.dirname(os.path.abspath(__file__)))
15-
16-
>>> old_tz = os.environ.get("TZ")
17-
>>> settings = Settings('test_settings')
18-
19-
>>> settings.INSTALLED_APPS
20-
['parent.app', 'parent.app1', 'parent.app_2']
21-
22-
>>> sys.path = old_sys_path
23-
24-
# Undo a side-effect of installing a new settings object.
25-
>>> if hasattr(time, "tzset") and old_tz:
26-
... os.environ["TZ"] = old_tz
27-
... time.tzset()
12+
def setUp(self):
13+
self.old_path = sys.path
14+
sys.path.append(os.path.dirname(os.path.abspath(__file__)))
15+
self.old_tz = os.environ.get("TZ")
16+
self.settings = Settings('test_settings')
2817

29-
"""}
18+
def tearDown(self):
19+
sys.path = self.old_path
20+
# Undo a side-effect of installing a new settings object.
21+
if hasattr(time, "tzset") and self.old_tz:
22+
os.environ["TZ"] = self.old_tz
23+
time.tzset()
24+
25+
def test_globbing(self):
26+
"""Test the globbing of INSTALLED_APPS"""
27+
self.assertEqual(self.settings.INSTALLED_APPS,
28+
['parent.app', 'parent.app1', 'parent.app_2'])
3029

3130
class EggLoadingTest(TestCase):
3231

0 commit comments

Comments
 (0)
{"resolvedServerColorMode":"day"}
0