Run collectstatic before coverage, use autoreload on celery worker

This commit is contained in:
Jens Langhammer 2019-04-11 13:54:11 +02:00
parent 19cd1624c1
commit a3ef26b7ad
3 changed files with 8 additions and 1 deletions

View File

@ -40,6 +40,7 @@ pylint:
stage: test stage: test
coverage: coverage:
script: script:
- python manage.py collectstatic --no-input
- coverage run manage.py test - coverage run manage.py test
- coverage report - coverage report
stage: test stage: test

View File

@ -15,7 +15,7 @@ class Command(BaseCommand):
"""Run CherryPy webserver""" """Run CherryPy webserver"""
def handle(self, *args, **options): def handle(self, *args, **options):
"""passbook cherrypy server""" """passbook daphne server"""
autoreload.run_with_reloader(self.daphne_server) autoreload.run_with_reloader(self.daphne_server)
def daphne_server(self): def daphne_server(self):

View File

@ -3,6 +3,7 @@
from logging import getLogger from logging import getLogger
from django.core.management.base import BaseCommand from django.core.management.base import BaseCommand
from django.utils import autoreload
from passbook.core.celery import CELERY_APP from passbook.core.celery import CELERY_APP
@ -14,4 +15,9 @@ class Command(BaseCommand):
def handle(self, *args, **options): def handle(self, *args, **options):
"""celery worker""" """celery worker"""
autoreload.run_with_reloader(self.celery_worker)
def celery_worker(self):
"""Run celery worker within autoreload"""
autoreload.raise_last_exception()
CELERY_APP.worker_main(['worker', '--autoscale=10,3', '-E', '-B']) CELERY_APP.worker_main(['worker', '--autoscale=10,3', '-E', '-B'])