|
@@ -7,7 +7,8 @@ from celery import loaders
|
|
|
from celery.loaders import base
|
|
|
from celery.loaders import default
|
|
|
|
|
|
-from celery.tests.utils import with_environ
|
|
|
+from celery.tests.compat import catch_warnings
|
|
|
+from celery.tests.utils import with_environ, execute_context
|
|
|
|
|
|
|
|
|
class TestLoaders(unittest.TestCase):
|
|
@@ -99,11 +100,18 @@ class TestDefaultLoader(unittest.TestCase):
|
|
|
sys.modules["celery"] = celery
|
|
|
|
|
|
def test_unconfigured_settings(self):
|
|
|
+ context_executed = [False]
|
|
|
|
|
|
class _Loader(default.Loader):
|
|
|
|
|
|
def import_from_cwd(self, name):
|
|
|
raise ImportError(name)
|
|
|
|
|
|
- l = _Loader()
|
|
|
- self.assertEqual(l.conf.CELERY_RESULT_BACKEND, "amqp")
|
|
|
+ def with_catch_warnings(log):
|
|
|
+ l = _Loader()
|
|
|
+ self.assertEqual(l.conf.CELERY_RESULT_BACKEND, "amqp")
|
|
|
+ context_executed[0] = True
|
|
|
+
|
|
|
+ context = catch_warnings(record=True)
|
|
|
+ execute_context(context, with_catch_warnings)
|
|
|
+ self.assertTrue(context_executed[0])
|