Removed some apps from ALWAYS_INSTALLED_APPS

This commit is contained in:
Claude Paroz 2014-06-21 18:27:46 +02:00
parent bc19ff6479
commit c6a711d9e5
5 changed files with 29 additions and 29 deletions

View File

@ -11,8 +11,15 @@ from django.test import TestCase, modify_settings, override_settings
from .models import Person, Company
@override_settings(ROOT_URLCONF='admin_docs.urls')
class MiscTests(TestCase):
@override_settings(
PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',),
ROOT_URLCONF='admin_docs.urls')
@modify_settings(INSTALLED_APPS={'append': 'django.contrib.admindocs'})
class AdminDocsTestCase(TestCase):
pass
class MiscTests(AdminDocsTestCase):
def setUp(self):
User.objects.create_superuser('super', None, 'secret')
@ -30,10 +37,8 @@ class MiscTests(TestCase):
self.client.get('/admindocs/views/') # should not raise
@override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',),
ROOT_URLCONF='admin_docs.urls')
@unittest.skipUnless(utils.docutils_is_available, "no docutils installed.")
class AdminDocViewTests(TestCase):
class AdminDocViewTests(AdminDocsTestCase):
fixtures = ['data.xml']
def setUp(self):
@ -108,9 +113,7 @@ class AdminDocViewTests(TestCase):
utils.docutils_is_available = True
@override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',),
ROOT_URLCONF='admin_docs.urls')
class XViewMiddlewareTest(TestCase):
class XViewMiddlewareTest(AdminDocsTestCase):
fixtures = ['data.xml']
def test_xview_func(self):
@ -151,8 +154,7 @@ class XViewMiddlewareTest(TestCase):
@unittest.skipUnless(utils.docutils_is_available, "no docutils installed.")
@override_settings(ROOT_URLCONF='admin_docs.urls')
class DefaultRoleTest(TestCase):
class DefaultRoleTest(AdminDocsTestCase):
def test_parse_rst(self):
"""
@ -187,10 +189,8 @@ class DefaultRoleTest(TestCase):
self.assertEqual(parts['fragment'], markup)
@override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',),
ROOT_URLCONF='admin_docs.urls')
@unittest.skipUnless(utils.docutils_is_available, "no docutils installed.")
class TestModelDetailView(TestCase):
class TestModelDetailView(AdminDocsTestCase):
"""
Tests that various details render correctly
"""

View File

@ -30,7 +30,7 @@ from django.forms.utils import ErrorList
from django.template.response import TemplateResponse
from django.test import TestCase, skipUnlessDBFeature
from django.test.utils import patch_logger
from django.test import override_settings
from django.test import modify_settings, override_settings
from django.utils import formats
from django.utils import translation
from django.utils.cache import get_max_age
@ -1491,7 +1491,8 @@ class AdminViewPermissionsTest(TestCase):
response = self.client.get(shortcut_url, follow=False)
# Can't use self.assertRedirects() because User.get_absolute_url() is silly.
self.assertEqual(response.status_code, 302)
self.assertEqual(response.url, 'http://example.com/dummy/foo/')
# Domain may depend on contrib.sites tests also run
six.assertRegex(self, response.url, 'http://(testserver|example.com)/dummy/foo/')
def test_has_module_permission(self):
"""
@ -4193,6 +4194,7 @@ except ImportError:
@unittest.skipUnless(docutils, "no docutils installed.")
@override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',),
ROOT_URLCONF="admin_views.urls")
@modify_settings(INSTALLED_APPS={'append': ['django.contrib.admindocs', 'django.contrib.flatpages']})
class AdminDocsTest(TestCase):
fixtures = ['admin-views-users.xml']

View File

@ -44,18 +44,10 @@ ALWAYS_INSTALLED_APPS = [
'django.contrib.contenttypes',
'django.contrib.auth',
'django.contrib.sites',
'django.contrib.flatpages',
'django.contrib.redirects',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.admin.apps.SimpleAdminConfig',
'django.contrib.admindocs',
'django.contrib.staticfiles',
'django.contrib.humanize',
'staticfiles_tests',
'staticfiles_tests.apps.test',
'staticfiles_tests.apps.no_label',
'servers.another_app',
]
ALWAYS_MIDDLEWARE_CLASSES = (

View File

@ -7,7 +7,7 @@ django.test.LiveServerTestCase.
import os
from django.core.exceptions import ImproperlyConfigured
from django.test import override_settings
from django.test import modify_settings, override_settings
from django.utils.six.moves.urllib.request import urlopen
from django.utils._os import upath
@ -86,12 +86,11 @@ class StaticLiveServerChecks(LiveServerBase):
class StaticLiveServerView(LiveServerBase):
# The test is going to access a static file stored in this application.
available_apps = ['staticfiles_tests.apps.test']
def urlopen(self, url):
return urlopen(self.live_server_url + url)
# The test is going to access a static file stored in this application.
@modify_settings(INSTALLED_APPS={'append': 'staticfiles_tests.apps.test'})
def test_collectstatic_emulation(self):
"""
Test that StaticLiveServerCase use of staticfiles' serve() allows it to

View File

@ -41,6 +41,15 @@ TEST_SETTINGS = {
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
'django.contrib.staticfiles.finders.DefaultStorageFinder',
),
'INSTALLED_APPS': (
'django.contrib.contenttypes',
'django.contrib.auth',
'django.contrib.admin.apps.SimpleAdminConfig',
'django.contrib.staticfiles',
'staticfiles_tests',
'staticfiles_tests.apps.test',
'staticfiles_tests.apps.no_label',
),
}
from django.contrib.staticfiles.management.commands.collectstatic import Command as CollectstaticCommand
@ -241,8 +250,6 @@ class TestFindStatic(CollectionTestCase, TestDefaults):
searched_locations)
self.assertIn(os.path.join('django', 'contrib', 'admin', 'static'),
searched_locations)
self.assertIn(os.path.join('tests', 'servers', 'another_app', 'static'),
searched_locations)
# FileSystemFinder searched locations
self.assertIn(TEST_SETTINGS['STATICFILES_DIRS'][1][1], searched_locations)
self.assertIn(TEST_SETTINGS['STATICFILES_DIRS'][0], searched_locations)