Browse Source

PEP8ify + pyflakes

Ask Solem 14 years ago
parent
commit
5e0afbfb08

+ 0 - 3
celery/tests/test_app/test_app.py

@@ -3,8 +3,6 @@ from __future__ import with_statement
 import os
 import sys
 
-from contextlib import contextmanager
-
 from mock import Mock
 
 from celery import Celery
@@ -261,7 +259,6 @@ class test_defaults(unittest.TestCase):
         self.assertRaises(TypeError, defaults.str_to_bool, "unsure")
 
 
-
 class test_debugging_utils(unittest.TestCase):
 
     def test_enable_disable_trace(self):

+ 1 - 1
celery/tests/test_app/test_app_amqp.py

@@ -4,7 +4,7 @@ from mock import Mock
 
 from celery.tests.utils import AppCase
 
-from celery.app.amqp import MSG_OPTIONS, extract_msg_options, TaskPublisher
+from celery.app.amqp import MSG_OPTIONS, extract_msg_options
 
 
 class TestMsgOptions(AppCase):

+ 3 - 4
celery/tests/test_bin/test_celeryd.py

@@ -25,8 +25,7 @@ from celery.bin.celeryd import WorkerCommand, windows_main, \
 from celery.exceptions import ImproperlyConfigured
 
 from celery.tests.compat import catch_warnings
-from celery.tests.utils import (AppCase, StringIO, mask_modules,
-                                reset_modules, patch_modules)
+from celery.tests.utils import AppCase, StringIO, mask_modules, reset_modules
 
 
 from celery.utils.patch import ensure_process_aware_logger
@@ -81,14 +80,14 @@ class test_compilation(AppCase):
         self.assertEqual(cpu_count(), 2)
         pcount.assert_called_with()
 
-    def test_process_name(self):
+    def test_process_name_wo_mp(self):
         with mask_modules("multiprocessing"):
             with reset_modules("celery.apps.worker"):
                 from celery.apps.worker import get_process_name
                 self.assertIsNone(get_process_name())
 
     @patch("multiprocessing.current_process")
-    def test_process_name(self, current_process):
+    def test_process_name_w_mp(self, current_process):
             from celery.apps.worker import get_process_name
             self.assertTrue(get_process_name())
 

+ 1 - 2
celery/tests/test_task/test_task.py

@@ -11,7 +11,6 @@ from celery.exceptions import RetryTaskError
 from celery.execute import send_task
 from celery.result import EagerResult
 from celery.schedules import crontab, crontab_parser
-from celery.utils import timeutils
 from celery.utils import gen_unique_id
 from celery.utils.timeutils import parse_iso8601
 
@@ -331,7 +330,7 @@ class TestCeleryTasks(unittest.TestCase):
         self.assertEqual(request.get("foo"), 32)
         self.assertEqual(request.get("bar", 36), 36)
 
-    def test_repr(self):
+    def test_task_class_repr(self):
         task = self.createTaskCls("T1", "c.unittest.t.repr")
         self.assertIn("class Task of", repr(task.app.Task))
 

+ 0 - 2
celery/tests/test_task/test_task_sets.py

@@ -1,7 +1,6 @@
 from __future__ import with_statement
 
 import anyjson
-import warnings
 
 from celery import registry
 from celery.app import app_or_default
@@ -159,7 +158,6 @@ class test_TaskSet(unittest.TestCase):
         ts.apply_async()
         self.assertEqual(applied[0], 3)
 
-
         class Publisher(object):
 
             def send(self, *args, **kwargs):

+ 0 - 1
celery/tests/test_utils/test_utils_encoding.py

@@ -25,4 +25,3 @@ class test_encoding(unittest.TestCase):
                 raise ValueError("foo")
 
         self.assertTrue(encoding.safe_repr(foo()))
-

+ 1 - 0
celery/tests/test_worker/test_worker.py

@@ -197,6 +197,7 @@ class test_QoS(unittest.TestCase):
         self.assertEqual(qos.prev, 12)
         qos.set(qos.prev)
 
+
 class test_Consumer(unittest.TestCase):
 
     def setUp(self):

+ 0 - 4
celery/tests/test_worker/test_worker_autoscale.py

@@ -1,5 +1,4 @@
 import logging
-import os
 
 from time import time
 
@@ -130,6 +129,3 @@ class test_Autoscaler(unittest.TestCase):
         x.run()
         _exit.assert_called_with(1)
         self.assertTrue(x.logger.error.call_count)
-
-
-

+ 0 - 3
celery/tests/test_worker/test_worker_control.py

@@ -136,7 +136,6 @@ class test_ControlPanel(unittest.TestCase):
         self.assertIn("rate_limit=200", info)
 
     def test_stats(self):
-        from celery.worker import state
         prev_count, state.total_count = state.total_count, 100
         try:
             self.assertDictContainsSubset({"total": 100,
@@ -146,7 +145,6 @@ class test_ControlPanel(unittest.TestCase):
             state.total_count = prev_count
 
     def test_active(self):
-        from celery.worker import state
         from celery.worker.job import TaskRequest
 
         r = TaskRequest(PingTask.name, "do re mi", (), {})
@@ -205,7 +203,6 @@ class test_ControlPanel(unittest.TestCase):
         self.assertIn("MyQueue", consumer.task_consumer.cancelled)
 
     def test_revoked(self):
-        from celery.worker import state
         state.revoked.clear()
         state.revoked.add("a1")
         state.revoked.add("a2")

+ 1 - 2
celery/tests/utils.py

@@ -276,6 +276,7 @@ def platform_pyimp(replace=None):
     if prev is not None:
         platform.python_implementation = prev
 
+
 @contextmanager
 def sys_platform(value):
     prev, sys.platform = sys.platform, value
@@ -318,5 +319,3 @@ def patch_modules(*modules):
             sys.modules.pop(name, None)
         else:
             sys.modules[name] = mod
-
-

+ 2 - 0
setup.cfg

@@ -7,8 +7,10 @@ cover3-exclude = celery
                  celery.tests.*
                  celery.bin.celeryd_multi
                  celery.bin.celeryd_detach
+                 celery.bin.celeryctl
                  celery.bin.camqadm
                  celery.execute
+                 celery.local
                  celery.platforms
                  celery.utils.patch
                  celery.utils.compat