diff options
author | Christopher Allan Webber <cwebber@dustycloud.org> | 2011-06-26 14:45:19 -0500 |
---|---|---|
committer | Christopher Allan Webber <cwebber@dustycloud.org> | 2011-06-26 14:45:19 -0500 |
commit | 9ea5c28b7a3bb74cebd923353b9e4c780e658d74 (patch) | |
tree | db6b94000136f160b703fbc1a2cb5a71a5cc1c8c /mediagoblin/celery_setup/from_celery.py | |
parent | 426685e088cd1867c12fc2721d2430e1be335297 (diff) | |
download | mediagoblin-9ea5c28b7a3bb74cebd923353b9e4c780e658d74.tar.lz mediagoblin-9ea5c28b7a3bb74cebd923353b9e4c780e658d74.tar.xz mediagoblin-9ea5c28b7a3bb74cebd923353b9e4c780e658d74.zip |
Celery wasn't really being properly connected during tests.
Lots of fixes to do this.
- setup_celery_from_config no longer responsible for checking
'celery_setup_elsewhere'; that's the app's job. (This was a problem
because more than the app was relying on using this function)
- Allow us to specifically set the config file we're setting up
celery from with setup_self
- Set up celery_always_eager. This is something we strongly want
while doing tests.
- Instead of setting up the app in the get_test_app method, let's set
that up simply by importing from_tests, which should itself up via
from_celery being the environment variable being set.
Diffstat (limited to 'mediagoblin/celery_setup/from_celery.py')
-rw-r--r-- | mediagoblin/celery_setup/from_celery.py | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/mediagoblin/celery_setup/from_celery.py b/mediagoblin/celery_setup/from_celery.py index 046aaa50..ed0a409e 100644 --- a/mediagoblin/celery_setup/from_celery.py +++ b/mediagoblin/celery_setup/from_celery.py @@ -23,7 +23,8 @@ from mediagoblin.celery_setup import setup_celery_from_config OUR_MODULENAME = __name__ -def setup_self(check_environ_for_conf=True, module_name=OUR_MODULENAME): +def setup_self(check_environ_for_conf=True, module_name=OUR_MODULENAME, + default_conf_file='mediagoblin.ini'): """ Transform this module into a celery config module by reading the mediagoblin config file. Set the environment variable @@ -36,9 +37,9 @@ def setup_self(check_environ_for_conf=True, module_name=OUR_MODULENAME): """ if check_environ_for_conf: mgoblin_conf_file = os.path.abspath( - os.environ.get('MEDIAGOBLIN_CONFIG', 'mediagoblin.ini')) + os.environ.get('MEDIAGOBLIN_CONFIG', default_conf_file)) else: - mgoblin_conf_file = 'mediagoblin.ini' + mgoblin_conf_file = default_conf_file if not os.path.exists(mgoblin_conf_file): raise IOError( @@ -48,6 +49,7 @@ def setup_self(check_environ_for_conf=True, module_name=OUR_MODULENAME): # this is the module that gets set up. os.environ['CELERY_CONFIG_MODULE'] = module_name app.MediaGoblinApp(mgoblin_conf_file, setup_celery=False) + setup_celery_from_config( mg_globals.app_config, mg_globals.global_config, settings_module=module_name, |