|
7 | 7 | from django.conf import Settings
|
8 | 8 | from django.db.models.loading import cache, load_app
|
9 | 9 |
|
10 |
| -__test__ = {"API_TESTS": """ |
11 |
| -Test the globbing of INSTALLED_APPS. |
| 10 | +class InstalledAppsGlobbingTest(TestCase): |
12 | 11 |
|
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') |
28 | 17 |
|
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']) |
30 | 29 |
|
31 | 30 | class EggLoadingTest(TestCase):
|
32 | 31 |
|
|
0 commit comments