From 8d2b91483c558de280b3862bdeebd3693b49dc80 Mon Sep 17 00:00:00 2001 From: Raffaele Salmaso Date: Thu, 22 Feb 2018 17:32:05 +0100 Subject: [PATCH] Cleanup test settings --- testproject/testproject/settings/base.py | 36 ++++++++++++------------ tests/core/test_checks.py | 6 +++- tests/settings.py | 14 ++++----- tests/testdata/urls.py | 1 - 4 files changed, 30 insertions(+), 27 deletions(-) diff --git a/testproject/testproject/settings/base.py b/testproject/testproject/settings/base.py index 9f66e2da..a7c4851f 100644 --- a/testproject/testproject/settings/base.py +++ b/testproject/testproject/settings/base.py @@ -28,26 +28,26 @@ ALLOWED_HOSTS = [] INSTALLED_APPS = [ - 'django.contrib.humanize', - 'django.contrib.auth', - 'django.contrib.contenttypes', - 'django.contrib.sessions', - 'django.contrib.sites', - 'django.contrib.messages', - 'django.contrib.staticfiles', - 'django.contrib.admin', - 'django.contrib.admindocs', + 'django.contrib.humanize.apps.HumanizeConfig', + 'django.contrib.auth.apps.AuthConfig', + 'django.contrib.contenttypes.apps.ContentTypesConfig', + 'django.contrib.sessions.apps.SessionsConfig', + 'django.contrib.sites.apps.SitesConfig', + 'django.contrib.messages.apps.MessagesConfig', + 'django.contrib.staticfiles.apps.StaticFilesConfig', + 'django.contrib.admin.apps.AdminConfig', + 'django.contrib.admindocs.apps.AdminDocsConfig', 'sekizai', 'sorl.thumbnail', - 'django_nyt', - 'wiki', - 'wiki.plugins.macros', - 'wiki.plugins.help', - 'wiki.plugins.links', - 'wiki.plugins.images', - 'wiki.plugins.attachments', - 'wiki.plugins.notifications', - 'wiki.plugins.globalhistory', + "django_nyt.apps.DjangoNytConfig", + "wiki.apps.WikiConfig", + "wiki.plugins.macros.apps.MacrosConfig", + 'wiki.plugins.help.apps.HelpConfig', + 'wiki.plugins.links.apps.LinksConfig', + "wiki.plugins.images.apps.ImagesConfig", + "wiki.plugins.attachments.apps.AttachmentsConfig", + "wiki.plugins.notifications.apps.NotificationsConfig", + 'wiki.plugins.globalhistory.apps.GlobalHistoryConfig', 'mptt', ] diff --git a/tests/core/test_checks.py b/tests/core/test_checks.py index b46cf3b1..a6466534 100644 --- a/tests/core/test_checks.py +++ b/tests/core/test_checks.py @@ -6,10 +6,14 @@ from django.test import TestCase from wiki.checks import OBSOLETE_INSTALLED_APPS, REQUIRED_CONTEXT_PROCESSORS, REQUIRED_INSTALLED_APPS, Tags +def _remove(settings, arg): + return [setting for setting in settings if not setting.startswith(arg)] + + class CheckTests(TestCase): def test_required_installed_apps(self): for app in REQUIRED_INSTALLED_APPS: - with self.modify_settings(INSTALLED_APPS={'remove': [app[0]]}): + with self.settings(INSTALLED_APPS=_remove(settings.INSTALLED_APPS, app[0])): errors = registry.run_checks(tags=[Tags.required_installed_apps]) expected_errors = [ Error( diff --git a/tests/settings.py b/tests/settings.py index 61deabe8..d5c09578 100644 --- a/tests/settings.py +++ b/tests/settings.py @@ -19,13 +19,13 @@ SITE_ID = 1 ROOT_URLCONF = 'tests.testdata.urls' INSTALLED_APPS = [ 'tests.testdata', - 'django.contrib.auth', - 'django.contrib.contenttypes', - 'django.contrib.sessions', - 'django.contrib.admin', - 'django.contrib.humanize', - 'django.contrib.sites', - 'django_nyt', + 'django.contrib.auth.apps.AuthConfig', + 'django.contrib.contenttypes.apps.ContentTypesConfig', + 'django.contrib.sessions.apps.SessionsConfig', + 'django.contrib.admin.apps.AdminConfig', + 'django.contrib.humanize.apps.HumanizeConfig', + 'django.contrib.sites.apps.SitesConfig', + 'django_nyt.apps.DjangoNytConfig', 'mptt', 'sekizai', 'sorl.thumbnail', diff --git a/tests/testdata/urls.py b/tests/testdata/urls.py index fac8d787..eb1c8163 100644 --- a/tests/testdata/urls.py +++ b/tests/testdata/urls.py @@ -4,7 +4,6 @@ from django.contrib.staticfiles.urls import staticfiles_urlpatterns from wiki.compat import include, url from wiki.urls import get_pattern as get_wiki_pattern -admin.autodiscover() urlpatterns = [ url(r'^admin/doc/', include('django.contrib.admindocs.urls')), -- 2.45.2