Ask Solem 9 years ago
parent
commit
045b52f145

+ 2 - 2
celery/tests/worker/test_components.py

@@ -7,7 +7,7 @@ from __future__ import absolute_import
 from celery.platforms import IS_WINDOWS
 from celery.worker.components import Pool
 
-from celery.tests.case import AppCase, Mock
+from celery.tests.case import AppCase, Mock, SkipTest
 
 
 class test_Pool(AppCase):
@@ -31,6 +31,6 @@ class test_Pool(AppCase):
         w = Mock()
         w.use_eventloop = w.pool_putlocks = w.pool_cls.uses_semaphore = True
         comp = Pool(w)
-        pool = w.pool = Mock()
+        w.pool = Mock()
         comp.create(w)
         self.assertIs(w.process_task, w._process_task_sem)

+ 2 - 2
celery/utils/abstract.py

@@ -8,13 +8,13 @@
 """
 from __future__ import absolute_import
 
-__all__ = ['CallableTask', 'CallableSignature']
-
 from abc import ABCMeta, abstractmethod, abstractproperty
 from collections import Callable
 
 from celery.five import with_metaclass
 
+__all__ = ['CallableTask', 'CallableSignature']
+
 
 def _hasattr(C, attr):
     return any(attr in B.__dict__ for B in C.__mro__)

+ 1 - 1
docs/conf.py

@@ -10,7 +10,7 @@ this = os.path.dirname(os.path.abspath(__file__))
 # absolute, like shown here.
 sys.path.insert(0, os.path.join(this, os.pardir))
 sys.path.append(os.path.join(this, '_ext'))
-import celery
+import celery  # noqa
 
 # General configuration
 # ---------------------

+ 0 - 2
examples/django/proj/celery.py

@@ -4,8 +4,6 @@ import os
 
 from celery import Celery
 
-from django.apps import apps as django_apps
-
 # set the default Django settings module for the 'celery' program.
 os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'proj.settings')
 

+ 1 - 1
examples/django/proj/wsgi.py

@@ -20,7 +20,7 @@ os.environ.setdefault("DJANGO_SETTINGS_MODULE", "proj.settings")
 # This application object is used by any WSGI server configured to use this
 # file. This includes Django's development server, if the WSGI_APPLICATION
 # setting points here.
-from django.core.wsgi import get_wsgi_application
+from django.core.wsgi import get_wsgi_application  # noqa
 application = get_wsgi_application()
 
 # Apply WSGI middleware here.

+ 4 - 2
extra/release/bump_version.py

@@ -12,11 +12,13 @@ import sys
 from contextlib import contextmanager
 from tempfile import NamedTemporaryFile
 
-rq = lambda s: s.strip("\"'")
-
 str_t = str if sys.version_info[0] >= 3 else basestring
 
 
+def rq(s):
+    return s.strip("\"'")
+
+
 def cmd(*args):
     return subprocess.Popen(args, stdout=subprocess.PIPE).communicate()[0]
 

+ 3 - 3
funtests/benchmarks/bench_worker.py

@@ -8,9 +8,9 @@ os.environ.update(
     USE_FAST_LOCALS='yes',
 )
 
-from celery import Celery
-from celery.five import range
-from kombu.five import monotonic
+from celery import Celery  # noqa
+from celery.five import range  # noqa
+from kombu.five import monotonic  # noqa
 
 DEFAULT_ITS = 40000
 

+ 1 - 0
funtests/stress/stress/app.py

@@ -150,6 +150,7 @@ def marker(s, sep='-'):
         except Exception as exc:
             print("Retrying marker.delay(). It failed to start: %s" % exc)
 
+
 @app.on_after_configure.connect
 def setup_periodic_tasks(sender, **kwargs):
     sender.add_periodic_task(10, add.s(2, 2), expires=10)

+ 1 - 2
funtests/stress/stress/suite.py

@@ -271,8 +271,7 @@ class Suite(BaseSuite):
     def always_timeout(self):
         self.join(
             group(sleeping.s(1).set(time_limit=0.1)
-                  for _ in range(100)
-            )(),
+                  for _ in range(100))(),
             timeout=10, propagate=True,
         )
 

+ 1 - 1
funtests/stress/stress/templates.py

@@ -50,7 +50,7 @@ def template_names():
 
 @template()
 class default(object):
-    BROKER_HEARTBEAT=30
+    BROKER_HEARTBEAT = 30
     CELERY_ACCEPT_CONTENT = ['json']
     CELERY_DEFAULT_QUEUE = CSTRESS_QUEUE
     CELERY_TASK_SERIALIZER = 'json'

+ 1 - 0
funtests/suite/__init__.py

@@ -1,6 +1,7 @@
 import os
 import sys
 
+sys.path.insert(0, os.getcwd())
 sys.path.insert(0, os.path.join(os.getcwd(), os.pardir))
 
 config = os.environ.setdefault('CELERY_FUNTEST_CONFIG_MODULE',

+ 2 - 4
funtests/suite/test_basic.py

@@ -1,10 +1,8 @@
+from __future__ import absolute_import
+
 import operator
-import os
-import sys
 
 # funtest config
-sys.path.insert(0, os.getcwd())
-sys.path.insert(0, os.path.join(os.getcwd(), os.pardir))
 import suite  # noqa
 
 from celery.five import range

+ 0 - 3
funtests/suite/test_leak.py

@@ -6,9 +6,6 @@ import sys
 import shlex
 import subprocess
 
-sys.path.insert(0, os.getcwd())
-sys.path.insert(0, os.path.join(os.getcwd(), os.pardir))
-
 from celery import current_app
 from celery.five import range
 from celery.tests.case import SkipTest, unittest

+ 9 - 3
setup.py

@@ -4,6 +4,7 @@
 from setuptools import setup, find_packages
 
 import os
+import re
 import sys
 import codecs
 
@@ -75,11 +76,13 @@ classifiers = [s.strip() for s in classes.split('\n') if s]
 
 # -*- Distribution Meta -*-
 
-import re
 re_meta = re.compile(r'__(\w+?)__\s*=\s*(.*)')
 re_vers = re.compile(r'VERSION\s*=.*?\((.*?)\)')
 re_doc = re.compile(r'^"""(.+?)"""')
-rq = lambda s: s.strip("\"'")
+
+
+def rq(s):
+    return s.strip("\"'")
 
 
 def add_default(m):
@@ -164,7 +167,10 @@ if CELERY_COMPAT_PROGRAMS:
 
 # -*- Extras -*-
 
-extras = lambda *p: reqs('extras', *p)
+
+def extras(*p):
+    return reqs('extras', *p)
+
 # Celery specific
 features = {
     'auth', 'cassandra', 'memcache', 'couchbase', 'threads',