From 623bee73b1632c313e95c828d4a39bea935760d0 Mon Sep 17 00:00:00 2001 From: Christopher Allan Webber Date: Sat, 18 Jun 2011 20:14:33 -0500 Subject: Nosetests should now be able to run using the new configobj / app init setup Lots of changes: - CELERY_CONFIG_FILE does not need to be set to the from_tests module to run tests anymore, in fact it *should not be set at all* and is specifically forbidden. - moved around the configuration to the new 2-file format - and generally adjusting the code appropriately. --- mediagoblin/celery_setup/from_tests.py | 42 ---------------------------------- 1 file changed, 42 deletions(-) delete mode 100644 mediagoblin/celery_setup/from_tests.py (limited to 'mediagoblin/celery_setup/from_tests.py') diff --git a/mediagoblin/celery_setup/from_tests.py b/mediagoblin/celery_setup/from_tests.py deleted file mode 100644 index 70814075..00000000 --- a/mediagoblin/celery_setup/from_tests.py +++ /dev/null @@ -1,42 +0,0 @@ -# GNU MediaGoblin -- federated, autonomous media hosting -# Copyright (C) 2011 Free Software Foundation, Inc -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public License -# along with this program. If not, see . - -import os - -from mediagoblin.tests.tools import TEST_APP_CONFIG -from mediagoblin import util -from mediagoblin.celery_setup import setup_celery_from_config - - -OUR_MODULENAME = __name__ - - -def setup_self(): - """ - Set up celery for testing's sake, which just needs to set up - celery and celery only. - """ - mgoblin_conf = util.read_config_file(TEST_APP_CONFIG) - mgoblin_section = mgoblin_conf['app:mediagoblin'] - - setup_celery_from_config( - mgoblin_section, mgoblin_conf, - settings_module=OUR_MODULENAME, - set_environ=False) - - -if os.environ.get('CELERY_CONFIG_MODULE') == OUR_MODULENAME: - setup_self() -- cgit v1.2.3 From eaca78748cd705b8ac7d987fc7e8a852eb690129 Mon Sep 17 00:00:00 2001 From: Christopher Allan Webber Date: Sun, 19 Jun 2011 16:43:23 -0500 Subject: Need to run nosetests with CELERY_CONFIG_MODULE set to from_tests again. Basically, if we don't do this celery sets itself up before it should and improperly. :\ --- mediagoblin/celery_setup/from_tests.py | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 mediagoblin/celery_setup/from_tests.py (limited to 'mediagoblin/celery_setup/from_tests.py') diff --git a/mediagoblin/celery_setup/from_tests.py b/mediagoblin/celery_setup/from_tests.py new file mode 100644 index 00000000..43032f41 --- /dev/null +++ b/mediagoblin/celery_setup/from_tests.py @@ -0,0 +1,26 @@ +# GNU MediaGoblin -- federated, autonomous media hosting +# Copyright (C) 2011 Free Software Foundation, Inc +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . + +import os + +from mediagoblin.celery_setup.from_celery import setup_self + + +OUR_MODULENAME = __name__ + + +if os.environ.get('CELERY_CONFIG_MODULE') == OUR_MODULENAME: + setup_self(check_environ_for_conf=False, module_name=OUR_MODULENAME) -- cgit v1.2.3