From 4d376238f0306bbdecfaa5ff4f91644e7c1fa17f Mon Sep 17 00:00:00 2001 From: Patrick Uiterwijk Date: May 31 2017 11:27:14 +0000 Subject: Use a more reliably and compatible way to set test broker url Signed-off-by: Patrick Uiterwijk --- diff --git a/pagure/lib/tasks.py b/pagure/lib/tasks.py index 07923f7..dbbcf98 100644 --- a/pagure/lib/tasks.py +++ b/pagure/lib/tasks.py @@ -33,6 +33,8 @@ _log = logging.getLogger(__name__) if os.environ.get('PAGURE_BROKER_URL'): broker_url = os.environ['PAGURE_BROKER_URL'] +elif APP.config.get('BROKER_URL'): + broker_url = APP.config['BROKER_URL'] else: broker_url = 'redis://%s' % APP.config['REDIS_HOST'] diff --git a/tests/__init__.py b/tests/__init__.py index 0e5614b..5b8c4b3 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -213,10 +213,9 @@ class Modeltests(unittest.TestCase): self.session = pagure.lib.model.create_tables( self.dbpath, acls=pagure.APP.config.get('ACLS', {})) - reload(pagure.lib.tasks) celery_broker_url = 'redis+socket://' + broker_url - pagure.lib.tasks.conn.conf.broker_url = celery_broker_url - pagure.lib.tasks.conn.conf.result_backend = celery_broker_url + pagure.APP.config['BROKER_URL'] = celery_broker_url + reload(pagure.lib.tasks) # Start a worker # Using cocurrency 2 to test with some concurrency, but not be heavy