Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
interfect
funkwhale
Commits
22370d1b
Verified
Commit
22370d1b
authored
Mar 31, 2018
by
Eliot Berriot
Browse files
Use pytest-env plugin to manage test settings instead of settings file
parent
f9c64947
Changes
4
Hide whitespace changes
Inline
Side-by-side
api/config/settings/test.py
deleted
100644 → 0
View file @
f9c64947
from
.common
import
*
# noqa
SECRET_KEY
=
env
(
"DJANGO_SECRET_KEY"
,
default
=
'test'
)
# Mail settings
# ------------------------------------------------------------------------------
EMAIL_HOST
=
'localhost'
EMAIL_PORT
=
1025
EMAIL_BACKEND
=
env
(
'DJANGO_EMAIL_BACKEND'
,
default
=
'django.core.mail.backends.console.EmailBackend'
)
# CACHING
# ------------------------------------------------------------------------------
CACHES
=
{
'default'
:
{
'BACKEND'
:
'django.core.cache.backends.locmem.LocMemCache'
,
'LOCATION'
:
''
}
}
CELERY_BROKER_URL
=
'memory://'
########## CELERY
# In development, all tasks will be executed locally by blocking until the task returns
CELERY_TASK_ALWAYS_EAGER
=
True
########## END CELERY
# Your local stuff: Below this line define 3rd party library settings
API_AUTHENTICATION_REQUIRED
=
False
CACHEOPS_ENABLED
=
False
api/requirements/test.txt
View file @
22370d1b
...
...
@@ -10,4 +10,5 @@ pytest-mock
pytest-sugar
pytest-xdist
pytest-cov
pytest-env
requests-mock
api/setup.cfg
View file @
22370d1b
...
...
@@ -7,6 +7,12 @@ max-line-length = 120
exclude=.tox,.git,*/migrations/*,*/static/CACHE/*,docs,node_modules
[tool:pytest]
DJANGO_SETTINGS_MODULE=config.settings.test
python_files = tests.py test_*.py *_tests.py
testpaths = tests
env =
SECRET_KEY=test
DJANGO_EMAIL_BACKEND=django.core.mail.backends.console.EmailBackend
CELERY_BROKER_URL=memory://
CELERY_TASK_ALWAYS_EAGER=True
CACHEOPS_ENABLED=False
FEDERATION_HOSTNAME=test.federation
api/tests/conftest.py
View file @
22370d1b
import
factory
import
tempfile
import
shutil
import
pytest
import
requests_mock
import
shutil
import
tempfile
from
django.contrib.auth.models
import
AnonymousUser
from
django.core.cache
import
cache
as
django_cache
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment