Merge branch 'aureplop/speed-up-tests' into 'master'

Speed up tests in dev (×40)

See merge request cof-geek/gestioCOF!281
This commit is contained in:
Martin Pepin 2018-02-05 22:18:52 +01:00
commit 09433f6f15
3 changed files with 18 additions and 15 deletions

View file

@ -7,6 +7,7 @@ the local development server should be here.
"""
import os
import sys
try:
from . import secret
@ -53,6 +54,8 @@ BASE_DIR = os.path.dirname(
os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
)
TESTING = sys.argv[1] == 'test'
# Application definition
INSTALLED_APPS = [

View file

@ -4,13 +4,18 @@ The settings that are not listed here are imported from .common
"""
from .common import * # NOQA
from .common import INSTALLED_APPS, MIDDLEWARE
from .common import INSTALLED_APPS, MIDDLEWARE, TESTING
EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
DEBUG = True
if TESTING:
PASSWORD_HASHERS = [
'django.contrib.auth.hashers.MD5PasswordHasher',
]
# ---
# Apache static/media config
@ -36,6 +41,7 @@ def show_toolbar(request):
"""
return DEBUG
if not TESTING:
INSTALLED_APPS += ["debug_toolbar", "debug_panel"]
MIDDLEWARE = [

View file

@ -245,13 +245,7 @@ class ViewTestCaseMixin(TestCaseMixin):
self.register_user(label, user)
if self.auth_user:
# The wrapper is a sanity check.
self.assertTrue(
self.client.login(
username=self.auth_user,
password=self.auth_user,
)
)
self.client.force_login(self.users[self.auth_user])
def tearDown(self):
del self.users_base