Merge branch 'test-setup' into 'develop'
Test setup See merge request funkwhale/funkwhale!87
This commit is contained in:
commit
c8b9e9506d
|
@ -0,0 +1,7 @@
|
||||||
|
#!/bin/bash
|
||||||
|
set -e
|
||||||
|
if [ $1 = "pytest" ]; then
|
||||||
|
# let pytest.ini handle it
|
||||||
|
unset DJANGO_SETTINGS_MODULE
|
||||||
|
fi
|
||||||
|
exec "$@"
|
|
@ -19,10 +19,6 @@ CACHES = {
|
||||||
|
|
||||||
CELERY_BROKER_URL = 'memory://'
|
CELERY_BROKER_URL = 'memory://'
|
||||||
|
|
||||||
# TESTING
|
|
||||||
# ------------------------------------------------------------------------------
|
|
||||||
TEST_RUNNER = 'django.test.runner.DiscoverRunner'
|
|
||||||
|
|
||||||
########## CELERY
|
########## CELERY
|
||||||
# In development, all tasks will be executed locally by blocking until the task returns
|
# In development, all tasks will be executed locally by blocking until the task returns
|
||||||
CELERY_TASK_ALWAYS_EAGER = True
|
CELERY_TASK_ALWAYS_EAGER = True
|
||||||
|
@ -30,3 +26,4 @@ CELERY_TASK_ALWAYS_EAGER = True
|
||||||
|
|
||||||
# Your local stuff: Below this line define 3rd party library settings
|
# Your local stuff: Below this line define 3rd party library settings
|
||||||
API_AUTHENTICATION_REQUIRED = False
|
API_AUTHENTICATION_REQUIRED = False
|
||||||
|
CACHEOPS_ENABLED = False
|
||||||
|
|
|
@ -1,42 +0,0 @@
|
||||||
version: '2'
|
|
||||||
services:
|
|
||||||
postgres:
|
|
||||||
image: postgres:9.5
|
|
||||||
|
|
||||||
api:
|
|
||||||
build: .
|
|
||||||
links:
|
|
||||||
- postgres
|
|
||||||
- redis
|
|
||||||
command: ./compose/django/gunicorn.sh
|
|
||||||
env_file: .env
|
|
||||||
volumes:
|
|
||||||
- ./media:/app/funkwhale_api/media
|
|
||||||
- ./staticfiles:/app/staticfiles
|
|
||||||
- ./music:/music
|
|
||||||
ports:
|
|
||||||
- "127.0.0.1:6001:5000"
|
|
||||||
|
|
||||||
redis:
|
|
||||||
image: redis:3.0
|
|
||||||
|
|
||||||
celeryworker:
|
|
||||||
build: .
|
|
||||||
env_file: .env
|
|
||||||
links:
|
|
||||||
- postgres
|
|
||||||
- redis
|
|
||||||
command: celery -A funkwhale_api.taskapp worker -l INFO
|
|
||||||
volumes:
|
|
||||||
- ./media:/app/funkwhale_api/media
|
|
||||||
- ./music:/music
|
|
||||||
environment:
|
|
||||||
- C_FORCE_ROOT=True
|
|
||||||
|
|
||||||
celerybeat:
|
|
||||||
build: .
|
|
||||||
env_file: .env
|
|
||||||
links:
|
|
||||||
- postgres
|
|
||||||
- redis
|
|
||||||
command: celery -A funkwhale_api.taskapp beat -l INFO
|
|
|
@ -23,3 +23,4 @@ RUN pip install -r /requirements/test.txt
|
||||||
|
|
||||||
COPY . /app
|
COPY . /app
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
ENTRYPOINT ["compose/django/dev-entrypoint.sh"]
|
||||||
|
|
|
@ -1,37 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
pip --version >/dev/null 2>&1 || {
|
|
||||||
echo >&2 -e "\npip is required but it's not installed."
|
|
||||||
echo >&2 -e "You can install it by running the following command:\n"
|
|
||||||
echo >&2 "wget https://bootstrap.pypa.io/get-pip.py --output-document=get-pip.py; chmod +x get-pip.py; sudo -H python3 get-pip.py"
|
|
||||||
echo >&2 -e "\n"
|
|
||||||
echo >&2 -e "\nFor more information, see pip documentation: https://pip.pypa.io/en/latest/"
|
|
||||||
exit 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
virtualenv --version >/dev/null 2>&1 || {
|
|
||||||
echo >&2 -e "\nvirtualenv is required but it's not installed."
|
|
||||||
echo >&2 -e "You can install it by running the following command:\n"
|
|
||||||
echo >&2 "sudo -H pip3 install virtualenv"
|
|
||||||
echo >&2 -e "\n"
|
|
||||||
echo >&2 -e "\nFor more information, see virtualenv documentation: https://virtualenv.pypa.io/en/latest/"
|
|
||||||
exit 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if [ -z "$VIRTUAL_ENV" ]; then
|
|
||||||
echo >&2 -e "\nYou need activate a virtualenv first"
|
|
||||||
echo >&2 -e 'If you do not have a virtualenv created, run the following command to create and automatically activate a new virtualenv named "venv" on current folder:\n'
|
|
||||||
echo >&2 -e "virtualenv venv --python=\`which python3\`"
|
|
||||||
echo >&2 -e "\nTo leave/disable the currently active virtualenv, run the following command:\n"
|
|
||||||
echo >&2 "deactivate"
|
|
||||||
echo >&2 -e "\nTo activate the virtualenv again, run the following command:\n"
|
|
||||||
echo >&2 "source venv/bin/activate"
|
|
||||||
echo >&2 -e "\nFor more information, see virtualenv documentation: https://virtualenv.pypa.io/en/latest/"
|
|
||||||
echo >&2 -e "\n"
|
|
||||||
exit 1;
|
|
||||||
else
|
|
||||||
|
|
||||||
pip install -r requirements/local.txt
|
|
||||||
pip install -r requirements/test.txt
|
|
||||||
pip install -r requirements.txt
|
|
||||||
fi
|
|
|
@ -1,6 +0,0 @@
|
||||||
[pytest]
|
|
||||||
DJANGO_SETTINGS_MODULE=config.settings.test
|
|
||||||
|
|
||||||
# -- recommended but optional:
|
|
||||||
python_files = tests.py test_*.py *_tests.py
|
|
||||||
testpatsh = tests
|
|
|
@ -59,3 +59,5 @@ ffmpeg-python==0.1.10
|
||||||
channels>=2,<2.1
|
channels>=2,<2.1
|
||||||
channels_redis>=2.1,<2.2
|
channels_redis>=2.1,<2.2
|
||||||
django-cacheops>=4,<4.1
|
django-cacheops>=4,<4.1
|
||||||
|
|
||||||
|
daphne==2.0.4
|
||||||
|
|
|
@ -3,8 +3,6 @@
|
||||||
coverage>=4.4,<4.5
|
coverage>=4.4,<4.5
|
||||||
django_coverage_plugin>=1.5,<1.6
|
django_coverage_plugin>=1.5,<1.6
|
||||||
Sphinx>=1.6,<1.7
|
Sphinx>=1.6,<1.7
|
||||||
django-extensions>=1.9,<1.10
|
|
||||||
Werkzeug>=0.13,<0.14
|
|
||||||
factory_boy>=2.8.1
|
factory_boy>=2.8.1
|
||||||
|
|
||||||
# django-debug-toolbar that works with Django 1.5+
|
# django-debug-toolbar that works with Django 1.5+
|
||||||
|
|
|
@ -3,5 +3,3 @@
|
||||||
|
|
||||||
# WSGI Handler
|
# WSGI Handler
|
||||||
# ------------------------------------------------
|
# ------------------------------------------------
|
||||||
|
|
||||||
daphne==2.0.4
|
|
||||||
|
|
|
@ -1,5 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
|
||||||
|
|
||||||
docker-compose -f $DIR/test.yml run test pytest "$@"
|
|
|
@ -5,3 +5,8 @@ exclude = .tox,.git,*/migrations/*,*/static/CACHE/*,docs,node_modules
|
||||||
[pep8]
|
[pep8]
|
||||||
max-line-length = 120
|
max-line-length = 120
|
||||||
exclude=.tox,.git,*/migrations/*,*/static/CACHE/*,docs,node_modules
|
exclude=.tox,.git,*/migrations/*,*/static/CACHE/*,docs,node_modules
|
||||||
|
|
||||||
|
[pytest]
|
||||||
|
DJANGO_SETTINGS_MODULE=config.settings.test
|
||||||
|
python_files = tests.py test_*.py *_tests.py
|
||||||
|
testpaths = tests
|
||||||
|
|
18
api/test.yml
18
api/test.yml
|
@ -1,18 +0,0 @@
|
||||||
version: '2'
|
|
||||||
services:
|
|
||||||
test:
|
|
||||||
build:
|
|
||||||
dockerfile: docker/Dockerfile.test
|
|
||||||
context: .
|
|
||||||
command: pytest
|
|
||||||
depends_on:
|
|
||||||
- postgres
|
|
||||||
volumes:
|
|
||||||
- .:/app
|
|
||||||
environment:
|
|
||||||
- "DJANGO_ALLOWED_HOSTS=localhost"
|
|
||||||
- "DATABASE_URL=postgresql://postgres@postgres/postgres"
|
|
||||||
- "FUNKWHALE_URL=https://funkwhale.test"
|
|
||||||
- "CACHEOPS_ENABLED=False"
|
|
||||||
postgres:
|
|
||||||
image: postgres
|
|
Loading…
Reference in New Issue