diff --git a/celery/app/task/__init__.py b/celery/app/task/__init__.py index 9d1db79a62f..7de1e7d7297 100644 --- a/celery/app/task/__init__.py +++ b/celery/app/task/__init__.py @@ -1,5 +1,6 @@ # -*- coding: utf-8 -*-" from __future__ import absolute_import +from __future__ import with_statement import sys import threading diff --git a/celery/security/__init__.py b/celery/security/__init__.py index 66870f15406..87d204be8b6 100644 --- a/celery/security/__init__.py +++ b/celery/security/__init__.py @@ -1,3 +1,6 @@ +from __future__ import absolute_import +from __future__ import with_statement + from kombu.serialization import unregister, SerializerNotInstalled from .. import current_app @@ -37,6 +40,7 @@ def setup_security(): "CELERY_SECURITY_CERT_STORE options are required " "settings when using the auth serializer") - with open(key) as kf, open(cert) as cf: - register_auth(kf.read(), cf.read(), store) + with open(key) as kf: + with open(cert) as cf: + register_auth(kf.read(), cf.read(), store) _disable_insecure_serializers() diff --git a/celery/tests/test_events/__init__.py b/celery/tests/test_events/__init__.py index 993c92694da..f1c164f70b4 100644 --- a/celery/tests/test_events/__init__.py +++ b/celery/tests/test_events/__init__.py @@ -1,3 +1,6 @@ +from __future__ import absolute_import +from __future__ import with_statement + import socket from functools import partial