summaryrefslogtreecommitdiff
path: root/tests/proxy_model_inheritance
diff options
context:
space:
mode:
authorAymeric Augustin <aymeric.augustin@m4x.org>2013-12-18 17:56:11 +0100
committerAymeric Augustin <aymeric.augustin@m4x.org>2013-12-22 11:39:17 +0100
commitf25fa9d8590c7759c1ec7ffecf1d67be81237674 (patch)
treec0a4a40a5371ad8e0d1c1af8c04295e874170041 /tests/proxy_model_inheritance
parent439b364e1e81371bd87488beed35ce051be8aaaa (diff)
downloaddjango-f25fa9d8590c7759c1ec7ffecf1d67be81237674.tar.gz
Deprecated load_app().
Adjusted several tests that used it to add apps to the app cache and then attempted to remove them by manipulating attributes directly. Also renamed invalid_models to invalid_models_tests to avoid clashing application labels between the outer and the inner invalid_models applications.
Diffstat (limited to 'tests/proxy_model_inheritance')
-rw-r--r--tests/proxy_model_inheritance/tests.py21
1 files changed, 6 insertions, 15 deletions
diff --git a/tests/proxy_model_inheritance/tests.py b/tests/proxy_model_inheritance/tests.py
index 601fdc5b42..01a2ddfef6 100644
--- a/tests/proxy_model_inheritance/tests.py
+++ b/tests/proxy_model_inheritance/tests.py
@@ -3,7 +3,6 @@ from __future__ import unicode_literals
import os
import sys
-from django.conf import settings
from django.core.apps import app_cache
from django.core.management import call_command
from django.test import TestCase, TransactionTestCase
@@ -21,28 +20,21 @@ class ProxyModelInheritanceTests(TransactionTestCase):
for the proxied model (as described in #12286). This test creates two dummy
apps and calls migrate, then verifies that the table has been created.
"""
-
- available_apps = []
+ available_apps = ['app1', 'app2']
def setUp(self):
self.old_sys_path = sys.path[:]
sys.path.append(os.path.dirname(os.path.abspath(upath(__file__))))
- for app in settings.INSTALLED_APPS:
- app_cache.load_app(app)
+ self._with_app1 = app_cache._begin_with_app('app1')
+ self._with_app2 = app_cache._begin_with_app('app2')
def tearDown(self):
+ app_cache._end_with_app(self._with_app1)
+ app_cache._end_with_app(self._with_app2)
sys.path = self.old_sys_path
- del app_cache.app_configs['app1']
- del app_cache.app_configs['app2']
- del app_cache.all_models['app1']
- del app_cache.all_models['app2']
def test_table_exists(self):
- try:
- app_cache.set_available_apps(settings.INSTALLED_APPS)
- call_command('migrate', verbosity=0)
- finally:
- app_cache.unset_available_apps()
+ call_command('migrate', verbosity=0)
from .app1.models import ProxyModel
from .app2.models import NiceModel
self.assertEqual(NiceModel.objects.all().count(), 0)
@@ -56,7 +48,6 @@ class MultiTableInheritanceProxyTest(TestCase):
Deleting an instance of a model proxying a multi-table inherited
subclass should cascade delete down the whole inheritance chain (see
#18083).
-
"""
instance = ConcreteModelSubclassProxy.objects.create()
instance.delete()