From c94b68376fcbf17467acf7483b569e60b3981f6f Mon Sep 17 00:00:00 2001 From: Lubomír Sedlář Date: Feb 26 2018 17:48:07 +0000 Subject: Allow tests to run in virtualenv If celery is installed in virtualenv, the executable will not be in /usr/bin. We also need make sure to preserve env from parent process and only add the new values (so that PATH adjusted by virtualenv still remains). --- diff --git a/tests/__init__.py b/tests/__init__.py index ca88171..4949857 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -336,12 +336,13 @@ class Modeltests(SimplePagureTest): # Using cocurrency 2 to test with some concurrency, but not be heavy # Using eventlet so that worker.terminate kills everything self.workerlog = open(os.path.join('.', 'worker.log'), 'w') - celery_exec = '/usr/bin/celery' - celery_env = { + celery_exec = 'celery' + celery_env = os.environ.copy() + celery_env.update({ 'PAGURE_BROKER_URL': celery_broker_url, 'PAGURE_CONFIG': os.path.join(self.path, 'config'), 'PYTHONPATH': '.' - } + }) celery_cwd = os.path.normpath( os.path.join(os.path.dirname(__file__), '..')