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:
commit
09433f6f15
|
@ -7,6 +7,7 @@ the local development server should be here.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
import sys
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from . import secret
|
from . import secret
|
||||||
|
@ -53,6 +54,8 @@ BASE_DIR = os.path.dirname(
|
||||||
os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
||||||
)
|
)
|
||||||
|
|
||||||
|
TESTING = sys.argv[1] == 'test'
|
||||||
|
|
||||||
|
|
||||||
# Application definition
|
# Application definition
|
||||||
INSTALLED_APPS = [
|
INSTALLED_APPS = [
|
||||||
|
|
|
@ -4,13 +4,18 @@ The settings that are not listed here are imported from .common
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from .common import * # NOQA
|
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'
|
EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
|
||||||
|
|
||||||
DEBUG = True
|
DEBUG = True
|
||||||
|
|
||||||
|
if TESTING:
|
||||||
|
PASSWORD_HASHERS = [
|
||||||
|
'django.contrib.auth.hashers.MD5PasswordHasher',
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
# ---
|
# ---
|
||||||
# Apache static/media config
|
# Apache static/media config
|
||||||
|
@ -36,6 +41,7 @@ def show_toolbar(request):
|
||||||
"""
|
"""
|
||||||
return DEBUG
|
return DEBUG
|
||||||
|
|
||||||
|
if not TESTING:
|
||||||
INSTALLED_APPS += ["debug_toolbar", "debug_panel"]
|
INSTALLED_APPS += ["debug_toolbar", "debug_panel"]
|
||||||
|
|
||||||
MIDDLEWARE = [
|
MIDDLEWARE = [
|
||||||
|
|
|
@ -245,13 +245,7 @@ class ViewTestCaseMixin(TestCaseMixin):
|
||||||
self.register_user(label, user)
|
self.register_user(label, user)
|
||||||
|
|
||||||
if self.auth_user:
|
if self.auth_user:
|
||||||
# The wrapper is a sanity check.
|
self.client.force_login(self.users[self.auth_user])
|
||||||
self.assertTrue(
|
|
||||||
self.client.login(
|
|
||||||
username=self.auth_user,
|
|
||||||
password=self.auth_user,
|
|
||||||
)
|
|
||||||
)
|
|
||||||
|
|
||||||
def tearDown(self):
|
def tearDown(self):
|
||||||
del self.users_base
|
del self.users_base
|
||||||
|
|
Loading…
Reference in a new issue