Commit 1c34d00e authored by Sascha Herzinger's avatar Sascha Herzinger
Browse files

fixing one test

parent fb3abf46
Pipeline #1312 failed with stage
in 45 seconds
......@@ -24,12 +24,13 @@ def init_celery(app):
backend=app.config['CELERY_RESULT_BACKEND'],
broker=app.config['CELERY_BROKER_URL'])
celery.conf.update(app.config)
# try:
# celery.connection().connect()
# except OSError as e:
# error_msg = """Could not establish connection to celery broker.
# URL: '{}'""".format(app.config['CELERY_BROKER_URL'])
# raise ConnectionRefusedError(error_msg) from e
try:
celery.connection().heartbeat_check()
except Exception as e:
error_msg = "Could not establish connection to {}".format(
app.config['CELERY_BROKER_URL'])
raise ConnectionRefusedError(error_msg) from e
TaskBase = celery.Task
class ContextTask(TaskBase):
......
......@@ -15,7 +15,7 @@ class BaseConfig(object):
REDIS_DB_PATH = os.path.join(os.sep, 'tmp', 'fractalis.db')
rdb = Redis(REDIS_DB_PATH)
CELERY_BROKER_URL = 'redis+socket://{}'.format(rdb.socket_file)
CELERY_RESULT_BACKEND = CELERY_BROKER_URL
CELERY_RESULT_BACKEND = 'redis+socket://{}'.format(rdb.socket_file)
class DevelopmentConfig(BaseConfig):
......
......@@ -16,7 +16,7 @@ class TestCelery(object):
def test_exception_if_no_connection_to_broker(self, app):
app.config['CELERY_BROKER_URL'] = 'redis+socket:///foobar.socket'
with pytest.raises(ConnectionRefusedError):
with pytest.raises(ConnectionError):
init_celery(app)
def test_exception_if_no_connection_to_result_backend(self, app):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment