Defined available_apps in relevant tests.

Fixed #20483.
This commit is contained in:
Aymeric Augustin 2013-06-04 08:09:29 +02:00
parent 4daf570b98
commit c6e6d4eeb7
26 changed files with 142 additions and 2 deletions

View file

@ -22,6 +22,8 @@ class ProxyModelInheritanceTests(TransactionTestCase):
apps and calls syncdb, then verifies that the table has been created.
"""
available_apps = []
def setUp(self):
self.old_sys_path = sys.path[:]
sys.path.append(os.path.dirname(os.path.abspath(upath(__file__))))
@ -38,7 +40,11 @@ class ProxyModelInheritanceTests(TransactionTestCase):
del cache.app_models['app2']
def test_table_exists(self):
call_command('syncdb', verbosity=0)
try:
cache.set_available_apps(settings.INSTALLED_APPS)
call_command('syncdb', verbosity=0)
finally:
cache.unset_available_apps()
from .app1.models import ProxyModel
from .app2.models import NiceModel
self.assertEqual(NiceModel.objects.all().count(), 0)