Browse Source

Using unittest.setup did not work well

Ask Solem 12 years ago
parent
commit
a11c40eaa1
1 changed files with 10 additions and 10 deletions
  1. 10 10
      celery/tests/__init__.py

+ 10 - 10
celery/tests/__init__.py

@@ -15,19 +15,19 @@ except NameError:
     class WindowsError(Exception):
         pass
 
+config_module = os.environ.setdefault(
+    'CELERY_TEST_CONFIG_MODULE', 'celery.tests.config',
+)
 
-def setup():
-    config_module = os.environ.setdefault(
-        'CELERY_TEST_CONFIG_MODULE', 'celery.tests.config',
-    )
+os.environ.setdefault('CELERY_CONFIG_MODULE', config_module)
+os.environ['CELERY_LOADER'] = 'default'
+os.environ['EVENTLET_NOPATCH'] = 'yes'
+os.environ['GEVENT_NOPATCH'] = 'yes'
+os.environ['KOMBU_DISABLE_LIMIT_PROTECTION'] = 'yes'
+os.environ['CELERY_BROKER_URL'] = 'memory://'
 
-    os.environ.setdefault('CELERY_CONFIG_MODULE', config_module)
-    os.environ['CELERY_LOADER'] = 'default'
-    os.environ['EVENTLET_NOPATCH'] = 'yes'
-    os.environ['GEVENT_NOPATCH'] = 'yes'
-    os.environ['KOMBU_DISABLE_LIMIT_PROTECTION'] = 'yes'
-    os.environ['CELERY_BROKER_URL'] = 'memory://'
 
+def setup():
     if os.environ.get('COVER_ALL_MODULES') or '--with-coverage3' in sys.argv:
         from celery.tests.utils import catch_warnings
         with catch_warnings(record=True):