From cf422858d4ba1352c2cb1c577d434fff92f25c51 Mon Sep 17 00:00:00 2001 From: Ask Solem Date: Thu, 26 Jan 2012 14:57:40 +0000 Subject: [PATCH] All test cases now inherits from celery.tests.utils.Case --- celery/tests/functional/case.py | 4 ++-- celery/tests/test_app/__init__.py | 14 +++++++------- celery/tests/test_app/test_annotations.py | 6 +++--- celery/tests/test_app/test_app_defaults.py | 4 ++-- celery/tests/test_app/test_beat.py | 10 +++++----- celery/tests/test_app/test_celery.py | 4 ++-- celery/tests/test_app/test_log.py | 7 +++---- celery/tests/test_app/test_routes.py | 8 ++++---- celery/tests/test_backends/__init__.py | 4 ++-- celery/tests/test_backends/test_amqp.py | 5 ++--- celery/tests/test_backends/test_base.py | 18 +++++++++--------- celery/tests/test_backends/test_cache.py | 8 ++++---- celery/tests/test_backends/test_database.py | 5 ++--- celery/tests/test_backends/test_mongodb.py | 4 ++-- .../tests/test_backends/test_pyredis_compat.py | 4 ++-- celery/tests/test_backends/test_redis.py | 7 +++---- celery/tests/test_backends/test_redis_unit.py | 4 ++-- celery/tests/test_backends/test_tyrant.py | 4 ++-- celery/tests/test_bin/test_celeryev.py | 5 ++--- celery/tests/test_compat/test_messaging.py | 4 ++-- celery/tests/test_concurrency/__init__.py | 4 ++-- .../test_concurrency_eventlet.py | 4 ++-- .../test_concurrency_processes.py | 4 ++-- .../test_concurrency/test_concurrency_solo.py | 4 ++-- celery/tests/test_concurrency/test_pool.py | 4 ++-- celery/tests/test_events/__init__.py | 10 +++++----- .../tests/test_events/test_events_cursesmon.py | 4 ++-- .../tests/test_events/test_events_snapshot.py | 6 +++--- celery/tests/test_events/test_events_state.py | 8 ++++---- celery/tests/test_security/case.py | 4 ++-- celery/tests/test_slow/test_buckets.py | 10 +++++----- celery/tests/test_task/__init__.py | 18 +++++++++--------- celery/tests/test_task/test_context.py | 4 ++-- celery/tests/test_task/test_execute_trace.py | 4 ++-- celery/tests/test_task/test_registry.py | 4 ++-- celery/tests/test_task/test_states.py | 4 ++-- celery/tests/test_task/test_task_abortable.py | 4 ++-- celery/tests/test_task/test_task_control.py | 6 +++--- celery/tests/test_task/test_task_http.py | 10 +++++----- celery/tests/test_utils/__init__.py | 10 +++++----- celery/tests/test_utils/test_datastructures.py | 17 ++++++++--------- celery/tests/test_utils/test_pickle.py | 4 ++-- celery/tests/test_utils/test_serialization.py | 5 ++--- celery/tests/test_utils/test_utils_encoding.py | 4 ++-- celery/tests/test_utils/test_utils_info.py | 4 ++-- .../tests/test_utils/test_utils_timeutils.py | 4 ++-- celery/tests/test_worker/test_bootsteps.py | 7 +++---- .../tests/test_worker/test_worker_autoscale.py | 4 ++-- .../tests/test_worker/test_worker_control.py | 4 ++-- .../tests/test_worker/test_worker_heartbeat.py | 4 ++-- .../tests/test_worker/test_worker_mediator.py | 4 ++-- celery/tests/test_worker/test_worker_revoke.py | 4 ++-- celery/tests/test_worker/test_worker_state.py | 4 ++-- 53 files changed, 158 insertions(+), 166 deletions(-) diff --git a/celery/tests/functional/case.py b/celery/tests/functional/case.py index 5bbdaf55db7..26f5e00fab3 100644 --- a/celery/tests/functional/case.py +++ b/celery/tests/functional/case.py @@ -15,7 +15,7 @@ from celery.task.control import ping, flatten_reply, inspect from celery.utils import qualname -from celery.tests.utils import unittest +from celery.tests.utils import Case HOSTNAME = socket.gethostname() @@ -103,7 +103,7 @@ def _ensure_shutdown_once(): return worker -class WorkerCase(unittest.TestCase): +class WorkerCase(Case): hostname = HOSTNAME worker = None diff --git a/celery/tests/test_app/__init__.py b/celery/tests/test_app/__init__.py index fd074d27a44..3ddbd5b1b58 100644 --- a/celery/tests/test_app/__init__.py +++ b/celery/tests/test_app/__init__.py @@ -15,7 +15,7 @@ from celery.utils.serialization import pickle from celery.tests import config -from celery.tests.utils import (unittest, mask_modules, platform_pyimp, +from celery.tests.utils import (Case, mask_modules, platform_pyimp, sys_platform, pypy_version) from celery.utils.mail import ErrorMail from kombu.utils import gen_unique_id @@ -38,7 +38,7 @@ def _get_test_config(): test_config = _get_test_config() -class test_App(unittest.TestCase): +class test_App(Case): def setUp(self): self.app = Celery(set_as_current=False) @@ -254,13 +254,13 @@ def test_error_mail_sender(self): self.assertTrue(x) -class test_BaseApp(unittest.TestCase): +class test_BaseApp(Case): def test_on_init(self): BaseApp() -class test_defaults(unittest.TestCase): +class test_defaults(Case): def test_str_to_bool(self): for s in ("false", "no", "0"): @@ -271,7 +271,7 @@ def test_str_to_bool(self): defaults.str_to_bool("unsure") -class test_debugging_utils(unittest.TestCase): +class test_debugging_utils(Case): def test_enable_disable_trace(self): try: @@ -283,7 +283,7 @@ def test_enable_disable_trace(self): _app.disable_trace() -class test_compilation(unittest.TestCase): +class test_compilation(Case): _clean = ("celery.app.base", ) def setUp(self): @@ -299,7 +299,7 @@ def test_kombu_version_check(self): __import__("celery.app.base") -class test_pyimplementation(unittest.TestCase): +class test_pyimplementation(Case): def test_platform_python_implementation(self): with platform_pyimp(lambda: "Xython"): diff --git a/celery/tests/test_app/test_annotations.py b/celery/tests/test_app/test_annotations.py index e2836921823..92f29339682 100644 --- a/celery/tests/test_app/test_annotations.py +++ b/celery/tests/test_app/test_annotations.py @@ -4,7 +4,7 @@ from celery.task import task from celery.utils import qualname -from celery.tests.utils import unittest +from celery.tests.utils import Case @task @@ -21,7 +21,7 @@ class MyAnnotation(object): foo = 65 -class test_MapAnnotation(unittest.TestCase): +class test_MapAnnotation(Case): def test_annotate(self): x = MapAnnotation({add.name: {"foo": 1}}) @@ -36,7 +36,7 @@ def test_annotate_any(self): self.assertIsNone(x.annotate_any()) -class test_prepare(unittest.TestCase): +class test_prepare(Case): def test_dict_to_MapAnnotation(self): x = prepare({add.name: {"foo": 3}}) diff --git a/celery/tests/test_app/test_app_defaults.py b/celery/tests/test_app/test_app_defaults.py index 1f0c946a93d..4b4dfeb8fd4 100644 --- a/celery/tests/test_app/test_app_defaults.py +++ b/celery/tests/test_app/test_app_defaults.py @@ -5,10 +5,10 @@ from importlib import import_module -from celery.tests.utils import unittest, pypy_version, sys_platform +from celery.tests.utils import Case, pypy_version, sys_platform -class test_defaults(unittest.TestCase): +class test_defaults(Case): def setUp(self): self._prev = sys.modules.pop("celery.app.defaults", None) diff --git a/celery/tests/test_app/test_beat.py b/celery/tests/test_app/test_beat.py index 236e547ac02..fd12edc7aa0 100644 --- a/celery/tests/test_app/test_beat.py +++ b/celery/tests/test_app/test_beat.py @@ -11,7 +11,7 @@ from celery.schedules import schedule from celery.task.base import Task from celery.utils import uuid -from celery.tests.utils import unittest +from celery.tests.utils import Case class Object(object): @@ -43,7 +43,7 @@ def stop(self, **kwargs): self.stopped = True -class test_ScheduleEntry(unittest.TestCase): +class test_ScheduleEntry(Case): Entry = beat.ScheduleEntry def create_entry(self, **kwargs): @@ -150,7 +150,7 @@ def is_due(self, last_run_at): always_pending = mocked_schedule(False, 1) -class test_Scheduler(unittest.TestCase): +class test_Scheduler(Case): def test_custom_schedule_dict(self): custom = {"foo": "bar"} @@ -248,7 +248,7 @@ def test_merge_inplace(self): self.assertEqual(a.schedule["bar"].schedule._next_run_at, 40) -class test_Service(unittest.TestCase): +class test_Service(Case): def get_service(self): sh = MockShelve() @@ -317,7 +317,7 @@ def test_start_manages_one_tick_before_shutdown(self): self.assertTrue(s._is_shutdown.isSet()) -class test_EmbeddedService(unittest.TestCase): +class test_EmbeddedService(Case): def test_start_stop_process(self): try: diff --git a/celery/tests/test_app/test_celery.py b/celery/tests/test_app/test_celery.py index c680a2a6e37..8044f515107 100644 --- a/celery/tests/test_app/test_celery.py +++ b/celery/tests/test_app/test_celery.py @@ -1,10 +1,10 @@ from __future__ import absolute_import -from celery.tests.utils import unittest +from celery.tests.utils import Case import celery -class TestInitFile(unittest.TestCase): +class TestInitFile(Case): def test_version(self): self.assertTrue(celery.VERSION) diff --git a/celery/tests/test_app/test_log.py b/celery/tests/test_app/test_log.py index f710e73434b..6e0c2e48513 100644 --- a/celery/tests/test_app/test_log.py +++ b/celery/tests/test_app/test_log.py @@ -12,12 +12,11 @@ setup_logging_subsystem) from celery.utils import uuid from celery.utils.compat import _CompatLoggerAdapter -from celery.tests.utils import unittest -from celery.tests.utils import (override_stdouts, wrap_logger, +from celery.tests.utils import (Case, override_stdouts, wrap_logger, get_handlers, set_handlers) -class test_default_logger(unittest.TestCase): +class test_default_logger(Case): def setUp(self): self.setup_logger = setup_logger @@ -144,7 +143,7 @@ def isEnabledFor(self, level): return True -class test_CompatLoggerAdapter(unittest.TestCase): +class test_CompatLoggerAdapter(Case): levels = ("debug", "info", "warn", "warning", diff --git a/celery/tests/test_app/test_routes.py b/celery/tests/test_app/test_routes.py index 3e75020c29f..1185da94b4a 100644 --- a/celery/tests/test_app/test_routes.py +++ b/celery/tests/test_app/test_routes.py @@ -7,7 +7,7 @@ from celery import current_app from celery.exceptions import QueueNotFound from celery.utils import maybe_promise -from celery.tests.utils import unittest +from celery.tests.utils import Case def E(queues): @@ -47,7 +47,7 @@ def __inner(*args, **kwargs): "routing_key": current_app.conf.CELERY_DEFAULT_ROUTING_KEY} -class test_MapRoute(unittest.TestCase): +class test_MapRoute(Case): @with_queues(foo=a_queue, bar=b_queue) def test_route_for_task_expanded_route(self): @@ -72,7 +72,7 @@ def test_expand_route_not_found(self): expand(route.route_for_task("a")) -class test_lookup_route(unittest.TestCase): +class test_lookup_route(Case): def test_init_queues(self): router = routes.Router(queues=None) @@ -125,7 +125,7 @@ def test_lookup_paths_traversed(self): dict(d_queue, queue=current_app.conf.CELERY_DEFAULT_QUEUE)) -class test_prepare(unittest.TestCase): +class test_prepare(Case): def test_prepare(self): from celery.datastructures import LRUCache diff --git a/celery/tests/test_backends/__init__.py b/celery/tests/test_backends/__init__.py index 79e3e1d7af9..dc115a820ef 100644 --- a/celery/tests/test_backends/__init__.py +++ b/celery/tests/test_backends/__init__.py @@ -4,10 +4,10 @@ from celery import backends from celery.backends.amqp import AMQPBackend from celery.backends.cache import CacheBackend -from celery.tests.utils import unittest +from celery.tests.utils import Case -class TestBackends(unittest.TestCase): +class TestBackends(Case): def test_get_backend_aliases(self): expects = [("amqp", AMQPBackend), diff --git a/celery/tests/test_backends/test_amqp.py b/celery/tests/test_backends/test_amqp.py index 4902b014a03..2a7041eae1d 100644 --- a/celery/tests/test_backends/test_amqp.py +++ b/celery/tests/test_backends/test_amqp.py @@ -15,8 +15,7 @@ from celery.exceptions import TimeoutError from celery.utils import uuid -from celery.tests.utils import unittest -from celery.tests.utils import sleepdeprived +from celery.tests.utils import Case, sleepdeprived class SomeClass(object): @@ -25,7 +24,7 @@ def __init__(self, data): self.data = data -class test_AMQPBackend(unittest.TestCase): +class test_AMQPBackend(Case): def create_backend(self, **opts): opts = dict(dict(serializer="pickle", persistent=False), **opts) diff --git a/celery/tests/test_backends/test_base.py b/celery/tests/test_backends/test_base.py index 2c8a4ff4207..7dd8af651a0 100644 --- a/celery/tests/test_backends/test_base.py +++ b/celery/tests/test_backends/test_base.py @@ -20,7 +20,7 @@ from celery.backends.base import BaseDictBackend, DisabledBackend from celery.utils import uuid -from celery.tests.utils import unittest +from celery.tests.utils import Case class wrapobject(object): @@ -38,7 +38,7 @@ def __init__(self, *args, **kwargs): b = BaseBackend() -class test_serialization(unittest.TestCase): +class test_serialization(Case): def test_create_exception_cls(self): self.assertTrue(serialization.create_exception_cls("FooError", "m")) @@ -47,7 +47,7 @@ def test_create_exception_cls(self): KeyError)) -class test_BaseBackend_interface(unittest.TestCase): +class test_BaseBackend_interface(Case): def test_get_status(self): with self.assertRaises(NotImplementedError): @@ -108,7 +108,7 @@ def test_on_chord_apply(self, unlock="celery.chord_unlock"): tasks[unlock] = p -class test_exception_pickle(unittest.TestCase): +class test_exception_pickle(Case): def test_oldstyle(self): if Oldstyle is None: @@ -127,7 +127,7 @@ def test_unpickleable(self): self.assertIsNone(fnpe(Impossible())) -class test_prepare_exception(unittest.TestCase): +class test_prepare_exception(Case): def test_unpickleable(self): x = b.prepare_exception(Unpickleable(1, 2, "foo")) @@ -193,7 +193,7 @@ def _delete_taskset(self, taskset_id): self._data.pop(taskset_id, None) -class test_BaseDictBackend(unittest.TestCase): +class test_BaseDictBackend(Case): def setUp(self): self.b = DictBackend() @@ -232,7 +232,7 @@ def test_reload_task_result(self): self.b._cache["task-exists"] = {"result": "task"} -class test_KeyValueStoreBackend(unittest.TestCase): +class test_KeyValueStoreBackend(Case): def setUp(self): self.b = KVBackend() @@ -277,7 +277,7 @@ def test_restore_missing_taskset(self): self.assertIsNone(self.b.restore_taskset("xxx-nonexistant")) -class test_KeyValueStoreBackend_interface(unittest.TestCase): +class test_KeyValueStoreBackend_interface(Case): def test_get(self): with self.assertRaises(NotImplementedError): @@ -303,7 +303,7 @@ def test_forget(self): KeyValueStoreBackend().forget("a") -class test_DisabledBackend(unittest.TestCase): +class test_DisabledBackend(Case): def test_store_result(self): DisabledBackend().store_result() diff --git a/celery/tests/test_backends/test_cache.py b/celery/tests/test_backends/test_cache.py index ce842160f4d..9fdef73d1cf 100644 --- a/celery/tests/test_backends/test_cache.py +++ b/celery/tests/test_backends/test_cache.py @@ -17,7 +17,7 @@ from celery.utils import uuid from celery.utils.encoding import str_to_bytes -from celery.tests.utils import unittest, mask_modules, reset_modules +from celery.tests.utils import Case, mask_modules, reset_modules class SomeClass(object): @@ -26,7 +26,7 @@ def __init__(self, data): self.data = data -class test_CacheBackend(unittest.TestCase): +class test_CacheBackend(Case): def setUp(self): self.tb = CacheBackend(backend="memory://") @@ -150,7 +150,7 @@ def mock_pylibmc(self): sys.modules["pylibmc"] = prev -class test_get_best_memcache(unittest.TestCase, MockCacheMixin): +class test_get_best_memcache(Case, MockCacheMixin): def test_pylibmc(self): with self.mock_pylibmc(): @@ -192,7 +192,7 @@ def test_backends(self): self.assertTrue(fun()) -class test_memcache_key(unittest.TestCase, MockCacheMixin): +class test_memcache_key(Case, MockCacheMixin): def test_memcache_unicode_key(self): with self.mock_memcache(): diff --git a/celery/tests/test_backends/test_database.py b/celery/tests/test_backends/test_database.py index a062800fe2c..5adf99bc94e 100644 --- a/celery/tests/test_backends/test_database.py +++ b/celery/tests/test_backends/test_database.py @@ -13,8 +13,7 @@ from celery.result import AsyncResult from celery.utils import uuid -from celery.tests.utils import mask_modules -from celery.tests.utils import unittest +from celery.tests.utils import Case, mask_modules try: import sqlalchemy # noqa @@ -31,7 +30,7 @@ def __init__(self, data): self.data = data -class test_DatabaseBackend(unittest.TestCase): +class test_DatabaseBackend(Case): def setUp(self): if sys.platform.startswith("java"): diff --git a/celery/tests/test_backends/test_mongodb.py b/celery/tests/test_backends/test_mongodb.py index 8e8e0ffe65a..a132672c463 100644 --- a/celery/tests/test_backends/test_mongodb.py +++ b/celery/tests/test_backends/test_mongodb.py @@ -7,7 +7,7 @@ from celery import states from celery.backends.mongodb import MongoBackend -from celery.tests.utils import unittest +from celery.tests.utils import Case try: @@ -30,7 +30,7 @@ @patch("celery.backends.mongodb.MongoBackend.encode", Mock()) @patch("pymongo.binary.Binary", Mock()) @patch("datetime.datetime", Mock()) -class TestBackendMongoDb(unittest.TestCase): +class TestBackendMongoDb(Case): def setUp(self): if pymongo is None: diff --git a/celery/tests/test_backends/test_pyredis_compat.py b/celery/tests/test_backends/test_pyredis_compat.py index 626c6b8af20..3a9c69e3924 100644 --- a/celery/tests/test_backends/test_pyredis_compat.py +++ b/celery/tests/test_backends/test_pyredis_compat.py @@ -3,10 +3,10 @@ from nose import SkipTest from celery.exceptions import ImproperlyConfigured -from celery.tests.utils import unittest +from celery.tests.utils import Case -class test_RedisBackend(unittest.TestCase): +class test_RedisBackend(Case): def test_constructor(self): from celery.backends import pyredis diff --git a/celery/tests/test_backends/test_redis.py b/celery/tests/test_backends/test_redis.py index c237e977453..614b7f5631a 100644 --- a/celery/tests/test_backends/test_redis.py +++ b/celery/tests/test_backends/test_redis.py @@ -12,8 +12,7 @@ from celery.utils import uuid from celery.backends import redis from celery.backends.redis import RedisBackend -from celery.tests.utils import mask_modules -from celery.tests.utils import unittest +from celery.tests.utils import Case, mask_modules _no_redis_msg = "* Redis %s. Will not execute related tests." _no_redis_msg_emitted = False @@ -57,7 +56,7 @@ def emit_no_redis_msg(reason): return emit_no_redis_msg("not configured") -class TestRedisBackend(unittest.TestCase): +class TestRedisBackend(Case): def test_mark_as_done(self): tb = get_redis_or_SkipTest() @@ -95,7 +94,7 @@ def test_mark_as_failure(self): self.assertIsInstance(tb.get_result(tid3), KeyError) -class TestRedisBackendNoRedis(unittest.TestCase): +class TestRedisBackendNoRedis(Case): def test_redis_None_if_redis_not_installed(self): prev = sys.modules.pop("celery.backends.redis") diff --git a/celery/tests/test_backends/test_redis_unit.py b/celery/tests/test_backends/test_redis_unit.py index e9c35cffe13..baa86c66a42 100644 --- a/celery/tests/test_backends/test_redis_unit.py +++ b/celery/tests/test_backends/test_redis_unit.py @@ -12,7 +12,7 @@ from celery.utils import cached_property, uuid from celery.utils.timeutils import timedelta_seconds -from celery.tests.utils import unittest +from celery.tests.utils import Case class Redis(object): @@ -57,7 +57,7 @@ def __init__(self, **kwargs): pass -class test_RedisBackend(unittest.TestCase): +class test_RedisBackend(Case): def get_backend(self): from celery.backends import redis diff --git a/celery/tests/test_backends/test_tyrant.py b/celery/tests/test_backends/test_tyrant.py index d78d1c77b4c..1ea58a0dcba 100644 --- a/celery/tests/test_backends/test_tyrant.py +++ b/celery/tests/test_backends/test_tyrant.py @@ -11,7 +11,7 @@ from celery.utils import uuid from celery.backends import tyrant from celery.backends.tyrant import TyrantBackend -from celery.tests.utils import unittest +from celery.tests.utils import Case _no_tyrant_msg = "* Tokyo Tyrant %s. Will not execute related tests." _no_tyrant_msg_emitted = False @@ -51,7 +51,7 @@ def emit_no_tyrant_msg(reason): raise SkipTest("Tokyo Tyrant not configured") -class TestTyrantBackend(unittest.TestCase): +class TestTyrantBackend(Case): def test_cached_connection(self): tb = get_tyrant_or_SkipTest() diff --git a/celery/tests/test_bin/test_celeryev.py b/celery/tests/test_bin/test_celeryev.py index 451617f2524..8cd8924b829 100644 --- a/celery/tests/test_bin/test_celeryev.py +++ b/celery/tests/test_bin/test_celeryev.py @@ -5,8 +5,7 @@ from celery.app import app_or_default from celery.bin import celeryev -from celery.tests.utils import unittest -from celery.tests.utils import patch +from celery.tests.utils import Case, patch class MockCommand(object): @@ -21,7 +20,7 @@ def proctitle(prog, info=None): proctitle.last = () -class test_EvCommand(unittest.TestCase): +class test_EvCommand(Case): def setUp(self): self.app = app_or_default() diff --git a/celery/tests/test_compat/test_messaging.py b/celery/tests/test_compat/test_messaging.py index 5708303b78b..8e606ceaf46 100644 --- a/celery/tests/test_compat/test_messaging.py +++ b/celery/tests/test_compat/test_messaging.py @@ -1,10 +1,10 @@ from __future__ import absolute_import from celery import messaging -from celery.tests.utils import unittest +from celery.tests.utils import Case -class test_compat_messaging_module(unittest.TestCase): +class test_compat_messaging_module(Case): def test_with_connection(self): diff --git a/celery/tests/test_concurrency/__init__.py b/celery/tests/test_concurrency/__init__.py index da00fccbed1..7884db03987 100644 --- a/celery/tests/test_concurrency/__init__.py +++ b/celery/tests/test_concurrency/__init__.py @@ -6,10 +6,10 @@ from itertools import count from celery.concurrency.base import apply_target, BasePool -from celery.tests.utils import unittest +from celery.tests.utils import Case -class test_BasePool(unittest.TestCase): +class test_BasePool(Case): def test_apply_target(self): diff --git a/celery/tests/test_concurrency/test_concurrency_eventlet.py b/celery/tests/test_concurrency/test_concurrency_eventlet.py index 03977624534..5f0fa679005 100644 --- a/celery/tests/test_concurrency/test_concurrency_eventlet.py +++ b/celery/tests/test_concurrency/test_concurrency_eventlet.py @@ -5,10 +5,10 @@ from nose import SkipTest -from celery.tests.utils import unittest +from celery.tests.utils import Case -class EventletCase(unittest.TestCase): +class EventletCase(Case): def setUp(self): if getattr(sys, "pypy_version_info", None): diff --git a/celery/tests/test_concurrency/test_concurrency_processes.py b/celery/tests/test_concurrency/test_concurrency_processes.py index ae6f48657bd..5f7cf047196 100644 --- a/celery/tests/test_concurrency/test_concurrency_processes.py +++ b/celery/tests/test_concurrency/test_concurrency_processes.py @@ -37,7 +37,7 @@ def apply_async(self, *args, **kwargs): from celery.datastructures import ExceptionInfo from celery.utils import noop -from celery.tests.utils import unittest +from celery.tests.utils import Case class Object(object): # for writeable attributes. @@ -117,7 +117,7 @@ class ExeMockTaskPool(mp.TaskPool): Pool = ExeMockPool -class test_TaskPool(unittest.TestCase): +class test_TaskPool(Case): def setUp(self): try: diff --git a/celery/tests/test_concurrency/test_concurrency_solo.py b/celery/tests/test_concurrency/test_concurrency_solo.py index 078fff6f453..b9d0fe1d2c1 100644 --- a/celery/tests/test_concurrency/test_concurrency_solo.py +++ b/celery/tests/test_concurrency/test_concurrency_solo.py @@ -4,10 +4,10 @@ from celery.concurrency import solo from celery.utils import noop -from celery.tests.utils import unittest +from celery.tests.utils import Case -class test_solo_TaskPool(unittest.TestCase): +class test_solo_TaskPool(Case): def test_on_start(self): x = solo.TaskPool() diff --git a/celery/tests/test_concurrency/test_pool.py b/celery/tests/test_concurrency/test_pool.py index c13d9e3ba9a..73987324137 100644 --- a/celery/tests/test_concurrency/test_pool.py +++ b/celery/tests/test_concurrency/test_pool.py @@ -8,7 +8,7 @@ from nose import SkipTest from celery.datastructures import ExceptionInfo -from celery.tests.utils import unittest +from celery.tests.utils import Case def do_something(i): @@ -26,7 +26,7 @@ def raise_something(i): return ExceptionInfo(sys.exc_info()) -class TestTaskPool(unittest.TestCase): +class TestTaskPool(Case): def setUp(self): try: diff --git a/celery/tests/test_events/__init__.py b/celery/tests/test_events/__init__.py index ee6a33c8629..c55bf5a6aea 100644 --- a/celery/tests/test_events/__init__.py +++ b/celery/tests/test_events/__init__.py @@ -5,7 +5,7 @@ from celery import events from celery.app import app_or_default -from celery.tests.utils import unittest +from celery.tests.utils import Case class MockProducer(object): @@ -29,7 +29,7 @@ def has_event(self, kind): return False -class TestEvent(unittest.TestCase): +class TestEvent(Case): def test_constructor(self): event = events.Event("world war II") @@ -37,7 +37,7 @@ def test_constructor(self): self.assertTrue(event["timestamp"]) -class TestEventDispatcher(unittest.TestCase): +class TestEventDispatcher(Case): def setUp(self): self.app = app_or_default() @@ -99,7 +99,7 @@ def test_enabled_disable(self): connection.close() -class TestEventReceiver(unittest.TestCase): +class TestEventReceiver(Case): def setUp(self): self.app = app_or_default() @@ -181,7 +181,7 @@ def handler(event): connection.close() -class test_misc(unittest.TestCase): +class test_misc(Case): def setUp(self): self.app = app_or_default() diff --git a/celery/tests/test_events/test_events_cursesmon.py b/celery/tests/test_events/test_events_cursesmon.py index e5008adc44c..2965c2ca3ef 100644 --- a/celery/tests/test_events/test_events_cursesmon.py +++ b/celery/tests/test_events/test_events_cursesmon.py @@ -2,7 +2,7 @@ from nose import SkipTest -from celery.tests.utils import unittest +from celery.tests.utils import Case class MockWindow(object): @@ -11,7 +11,7 @@ def getmaxyx(self): return self.y, self.x -class TestCursesDisplay(unittest.TestCase): +class TestCursesDisplay(Case): def setUp(self): try: diff --git a/celery/tests/test_events/test_events_snapshot.py b/celery/tests/test_events/test_events_snapshot.py index d8bbff27cf0..db3aac1dec3 100644 --- a/celery/tests/test_events/test_events_snapshot.py +++ b/celery/tests/test_events/test_events_snapshot.py @@ -4,7 +4,7 @@ from celery.app import app_or_default from celery.events import Events from celery.events.snapshot import Polaroid, evcam -from celery.tests.utils import unittest +from celery.tests.utils import Case class TRef(object): @@ -27,7 +27,7 @@ def apply_interval(self, msecs, fun, *args, **kwargs): timer = MockTimer() -class test_Polaroid(unittest.TestCase): +class test_Polaroid(Case): def setUp(self): self.app = app_or_default() @@ -98,7 +98,7 @@ def handler(**kwargs): self.assertEqual(shutter_signal_sent[0], 1) -class test_evcam(unittest.TestCase): +class test_evcam(Case): class MockReceiver(object): raise_keyboard_interrupt = False diff --git a/celery/tests/test_events/test_events_state.py b/celery/tests/test_events/test_events_state.py index 52fd961e5e8..b8817f5a83f 100644 --- a/celery/tests/test_events/test_events_state.py +++ b/celery/tests/test_events/test_events_state.py @@ -8,7 +8,7 @@ from celery.events import Event from celery.events.state import State, Worker, Task, HEARTBEAT_EXPIRE from celery.utils import uuid -from celery.tests.utils import unittest +from celery.tests.utils import Case class replay(object): @@ -93,7 +93,7 @@ def setup(self): uuid=uuid(), hostname=worker)) -class test_Worker(unittest.TestCase): +class test_Worker(Case): def test_survives_missing_timestamp(self): worker = Worker(hostname="foo") @@ -104,7 +104,7 @@ def test_repr(self): self.assertTrue(repr(Worker(hostname="foo"))) -class test_Task(unittest.TestCase): +class test_Task(Case): def test_info(self): task = Task(uuid="abcdefg", @@ -158,7 +158,7 @@ def test_repr(self): self.assertTrue(repr(Task(uuid="xxx", name="tasks.add"))) -class test_State(unittest.TestCase): +class test_State(Case): def test_repr(self): self.assertTrue(repr(State())) diff --git a/celery/tests/test_security/case.py b/celery/tests/test_security/case.py index 6f8f5bab6dc..ae60fe6f617 100644 --- a/celery/tests/test_security/case.py +++ b/celery/tests/test_security/case.py @@ -2,10 +2,10 @@ from nose import SkipTest -from celery.tests.utils import unittest +from celery.tests.utils import Case -class SecurityCase(unittest.TestCase): +class SecurityCase(Case): def setUp(self): try: diff --git a/celery/tests/test_slow/test_buckets.py b/celery/tests/test_slow/test_buckets.py index 2de7e399215..2ac36371882 100644 --- a/celery/tests/test_slow/test_buckets.py +++ b/celery/tests/test_slow/test_buckets.py @@ -13,7 +13,7 @@ from celery.utils import uuid from celery.worker import buckets -from celery.tests.utils import skip_if_environ, unittest +from celery.tests.utils import Case, skip_if_environ skip_if_disabled = partial(skip_if_environ("SKIP_RLIMITS")) @@ -40,7 +40,7 @@ def __repr__(self): self.task_name, self.task_id, self.args, self.kwargs) -class test_TokenBucketQueue(unittest.TestCase): +class test_TokenBucketQueue(Case): @skip_if_disabled def empty_queue_yields_QueueEmpty(self): @@ -95,7 +95,7 @@ def test_qsize(self): self.assertEqual(x.get_nowait(), "The quick brown fox") -class test_rate_limit_string(unittest.TestCase): +class test_rate_limit_string(Case): @skip_if_disabled def test_conversion(self): @@ -126,7 +126,7 @@ class TaskD(Task): rate_limit = "1000/m" -class test_TaskBucket(unittest.TestCase): +class test_TaskBucket(Case): def setUp(self): self.registry = TaskRegistry() @@ -288,7 +288,7 @@ def test_items(self): self.assertEqual(sorted(x.items), [1, 2, 3]) -class test_FastQueue(unittest.TestCase): +class test_FastQueue(Case): def test_items(self): x = buckets.FastQueue() diff --git a/celery/tests/test_task/__init__.py b/celery/tests/test_task/__init__.py index 4332a5e47fe..e42a3f9a463 100644 --- a/celery/tests/test_task/__init__.py +++ b/celery/tests/test_task/__init__.py @@ -14,7 +14,7 @@ from celery.utils import uuid from celery.utils.timeutils import parse_iso8601 -from celery.tests.utils import with_eager_tasks, unittest, WhateverIO +from celery.tests.utils import Case, with_eager_tasks, WhateverIO def return_True(*args, **kwargs): @@ -128,7 +128,7 @@ def run(self, arg1, arg2, kwarg=1, **kwargs): countdown=0, exc=exc) -class TestTaskRetries(unittest.TestCase): +class TestTaskRetries(Case): def test_retry(self): RetryTask.max_retries = 3 @@ -204,7 +204,7 @@ def test_max_retries_exceeded(self): self.assertEqual(RetryTask.iterations, 2) -class TestCeleryTasks(unittest.TestCase): +class TestCeleryTasks(Case): def test_unpickle_task(self): import pickle @@ -420,7 +420,7 @@ def test_get_logger(self): self.assertTrue(logger) -class TestTaskSet(unittest.TestCase): +class TestTaskSet(Case): @with_eager_tasks def test_function_taskset(self): @@ -467,7 +467,7 @@ def test_named_taskset(self): self.assertTrue(res.taskset_id.startswith(prefix)) -class TestTaskApply(unittest.TestCase): +class TestTaskApply(Case): def test_apply_throw(self): with self.assertRaises(KeyError): @@ -510,7 +510,7 @@ class MyPeriodic(task.PeriodicTask): run_every = timedelta(hours=1) -class TestPeriodicTask(unittest.TestCase): +class TestPeriodicTask(Case): def test_must_have_run_every(self): with self.assertRaises(NotImplementedError): @@ -578,7 +578,7 @@ def __inner(*args, **kwargs): return create_patcher -class test_crontab_parser(unittest.TestCase): +class test_crontab_parser(Case): def test_parse_star(self): self.assertEqual(crontab_parser(24).parse('*'), set(range(24))) @@ -653,7 +653,7 @@ def test_eq(self): self.assertFalse(crontab(minute="1") == object()) -class test_crontab_remaining_estimate(unittest.TestCase): +class test_crontab_remaining_estimate(Case): def next_ocurrance(self, crontab, now): crontab.nowfun = lambda: now @@ -703,7 +703,7 @@ def test_not_weekday(self): self.assertEqual(next, datetime(2010, 9, 13, 0, 5)) -class test_crontab_is_due(unittest.TestCase): +class test_crontab_is_due(Case): def setUp(self): self.now = datetime.utcnow() diff --git a/celery/tests/test_task/test_context.py b/celery/tests/test_task/test_context.py index 58c84b23606..0a38f2c70b1 100644 --- a/celery/tests/test_task/test_context.py +++ b/celery/tests/test_task/test_context.py @@ -4,7 +4,7 @@ import threading from celery.task.base import Context -from celery.tests.utils import unittest +from celery.tests.utils import Case # Retreive the values of all context attributes as a @@ -37,7 +37,7 @@ def run(self): self.result = get_context_as_dict(self.ctx) -class TestTaskContext(unittest.TestCase): +class TestTaskContext(Case): def test_default_context(self): # A bit of a tautological test, since it uses the same diff --git a/celery/tests/test_task/test_execute_trace.py b/celery/tests/test_task/test_execute_trace.py index f9d0772eac3..6e66c15cc2c 100644 --- a/celery/tests/test_task/test_execute_trace.py +++ b/celery/tests/test_task/test_execute_trace.py @@ -5,7 +5,7 @@ from celery import states from celery.exceptions import RetryTaskError from celery.execute.trace import eager_trace_task -from celery.tests.utils import unittest +from celery.tests.utils import Case @current_app.task @@ -23,7 +23,7 @@ def trace(task, args=(), kwargs={}, propagate=False): propagate=propagate) -class test_trace(unittest.TestCase): +class test_trace(Case): def test_trace_successful(self): retval, info = trace(add, (2, 2), {}) diff --git a/celery/tests/test_task/test_registry.py b/celery/tests/test_task/test_registry.py index 0269c2f0dd2..eabde8174c2 100644 --- a/celery/tests/test_task/test_registry.py +++ b/celery/tests/test_task/test_registry.py @@ -3,7 +3,7 @@ from celery import registry from celery.task import Task, PeriodicTask -from celery.tests.utils import unittest +from celery.tests.utils import Case class TestTask(Task): @@ -21,7 +21,7 @@ def run(self, **kwargs): return True -class TestTaskRegistry(unittest.TestCase): +class TestTaskRegistry(Case): def assertRegisterUnregisterCls(self, r, task): with self.assertRaises(r.NotRegistered): diff --git a/celery/tests/test_task/test_states.py b/celery/tests/test_task/test_states.py index c4386817576..2c263e06b4d 100644 --- a/celery/tests/test_task/test_states.py +++ b/celery/tests/test_task/test_states.py @@ -2,10 +2,10 @@ from celery.states import state from celery import states -from celery.tests.utils import unittest +from celery.tests.utils import Case -class test_state_precedence(unittest.TestCase): +class test_state_precedence(Case): def test_gt(self): self.assertGreater(state(states.SUCCESS), diff --git a/celery/tests/test_task/test_task_abortable.py b/celery/tests/test_task/test_task_abortable.py index e36040bbac4..284c6bdc8b1 100644 --- a/celery/tests/test_task/test_task_abortable.py +++ b/celery/tests/test_task/test_task_abortable.py @@ -1,7 +1,7 @@ from __future__ import absolute_import from celery.contrib.abortable import AbortableTask, AbortableAsyncResult -from celery.tests.utils import unittest +from celery.tests.utils import Case class MyAbortableTask(AbortableTask): @@ -10,7 +10,7 @@ def run(self, **kwargs): return True -class TestAbortableTask(unittest.TestCase): +class TestAbortableTask(Case): def test_async_result_is_abortable(self): t = MyAbortableTask() diff --git a/celery/tests/test_task/test_task_control.py b/celery/tests/test_task/test_task_control.py index d3a14633d06..31954a8fa85 100644 --- a/celery/tests/test_task/test_task_control.py +++ b/celery/tests/test_task/test_task_control.py @@ -9,7 +9,7 @@ from celery.task import control from celery.task import PingTask from celery.utils import uuid -from celery.tests.utils import unittest +from celery.tests.utils import Case class MockMailbox(Mailbox): @@ -41,7 +41,7 @@ def _resets(*args, **kwargs): return _resets -class test_inspect(unittest.TestCase): +class test_inspect(Case): def setUp(self): app = app_or_default() @@ -112,7 +112,7 @@ def test_cancel_consumer(self): self.assertIn("cancel_consumer", MockMailbox.sent) -class test_Broadcast(unittest.TestCase): +class test_Broadcast(Case): def setUp(self): self.app = app_or_default() diff --git a/celery/tests/test_task/test_task_http.py b/celery/tests/test_task/test_task_http.py index d525856ab51..1040e6e6996 100644 --- a/celery/tests/test_task/test_task_http.py +++ b/celery/tests/test_task/test_task_http.py @@ -14,7 +14,7 @@ from anyjson import serialize from celery.task import http -from celery.tests.utils import unittest +from celery.tests.utils import Case from celery.utils.compat import StringIO from celery.utils.encoding import from_utf8 @@ -53,7 +53,7 @@ def unknown_response(): return _response(serialize({"status": "u.u.u.u", "retval": True})) -class TestEncodings(unittest.TestCase): +class TestEncodings(Case): def test_utf8dict(self): uk = "foobar" @@ -65,7 +65,7 @@ def test_utf8dict(self): self.assertIsInstance(value, str) -class TestMutableURL(unittest.TestCase): +class TestMutableURL(Case): def test_url_query(self): url = http.MutableURL("http://example.com?x=10&y=20&z=Foo") @@ -97,7 +97,7 @@ def test_set_query(self): self.assertEqual(url.query, {"zzz": "xxx"}) -class TestHttpDispatch(unittest.TestCase): +class TestHttpDispatch(Case): def test_dispatch_success(self): logger = logging.getLogger("celery.unittest") @@ -152,7 +152,7 @@ def test_dispatch_POST(self): self.assertEqual(d.dispatch(), 100) -class TestURL(unittest.TestCase): +class TestURL(Case): def test_URL_get_async(self): http.HttpDispatchTask.app.conf.CELERY_ALWAYS_EAGER = True diff --git a/celery/tests/test_utils/__init__.py b/celery/tests/test_utils/__init__.py index 284e19d0f2a..a368ffa150c 100644 --- a/celery/tests/test_utils/__init__.py +++ b/celery/tests/test_utils/__init__.py @@ -4,14 +4,14 @@ from celery import utils from celery.utils import promise, mpromise from celery.utils.threads import bgThread -from celery.tests.utils import unittest +from celery.tests.utils import Case def double(x): return x * 2 -class test_bgThread_interface(unittest.TestCase): +class test_bgThread_interface(Case): def test_body(self): x = bgThread() @@ -19,7 +19,7 @@ def test_body(self): x.body() -class test_chunks(unittest.TestCase): +class test_chunks(Case): def test_chunks(self): @@ -39,7 +39,7 @@ def test_chunks(self): [[0, 1], [2, 3], [4, 5], [6, 7], [8, 9]]) -class test_utils(unittest.TestCase): +class test_utils(Case): def test_qualname(self): Class = type("Fox", (object, ), {"__module__": "quick.brown"}) @@ -127,7 +127,7 @@ def fun(obj): self.assertIs(x.__delete__(None), x) -class test_mpromise(unittest.TestCase): +class test_mpromise(Case): def test_is_memoized(self): diff --git a/celery/tests/test_utils/test_datastructures.py b/celery/tests/test_utils/test_datastructures.py index 9d98b07b760..c06e4d732e8 100644 --- a/celery/tests/test_utils/test_datastructures.py +++ b/celery/tests/test_utils/test_datastructures.py @@ -6,15 +6,14 @@ from celery.datastructures import (ExceptionInfo, LRUCache, LimitedSet, AttributeDict, DictAttribute, ConfigurationView, DependencyGraph) -from celery.tests.utils import unittest -from celery.tests.utils import WhateverIO +from celery.tests.utils import Case, WhateverIO class Object(object): pass -class test_DictAttribute(unittest.TestCase): +class test_DictAttribute(Case): def test_get_set(self): x = DictAttribute(Object()) @@ -48,7 +47,7 @@ def test_items(self): dict(attr1=1, attr2=2)) -class test_ConfigurationView(unittest.TestCase): +class test_ConfigurationView(Case): def setUp(self): self.view = ConfigurationView({"changed_key": 1, @@ -91,7 +90,7 @@ def test_iter(self): self.assertItemsEqual(self.view.values(), expected.values()) -class test_ExceptionInfo(unittest.TestCase): +class test_ExceptionInfo(Case): def test_exception_info(self): @@ -111,7 +110,7 @@ def test_exception_info(self): self.assertTrue(r) -class test_LimitedSet(unittest.TestCase): +class test_LimitedSet(Case): def test_add(self): s = LimitedSet(maxlen=2) @@ -169,7 +168,7 @@ def test_as_dict(self): self.assertIsInstance(s.as_dict(), dict) -class test_LRUCache(unittest.TestCase): +class test_LRUCache(Case): def test_expires(self): limit = 100 @@ -246,7 +245,7 @@ def test_items(self): self.assertTrue(c.items()) -class test_AttributeDict(unittest.TestCase): +class test_AttributeDict(Case): def test_getattr__setattr(self): x = AttributeDict({"foo": "bar"}) @@ -257,7 +256,7 @@ def test_getattr__setattr(self): self.assertEqual(x["bar"], "foo") -class test_DependencyGraph(unittest.TestCase): +class test_DependencyGraph(Case): def graph1(self): return DependencyGraph([ diff --git a/celery/tests/test_utils/test_pickle.py b/celery/tests/test_utils/test_pickle.py index 6772728a261..8f352f20cfc 100644 --- a/celery/tests/test_utils/test_pickle.py +++ b/celery/tests/test_utils/test_pickle.py @@ -1,7 +1,7 @@ from __future__ import absolute_import from celery.utils.serialization import pickle -from celery.tests.utils import unittest +from celery.tests.utils import Case class RegularException(Exception): @@ -15,7 +15,7 @@ def __init__(self, message, status_code=10): Exception.__init__(self, message, status_code) -class TestPickle(unittest.TestCase): +class TestPickle(Case): def test_pickle_regular_exception(self): exc = None diff --git a/celery/tests/test_utils/test_serialization.py b/celery/tests/test_utils/test_serialization.py index 883d32de263..61b8c293807 100644 --- a/celery/tests/test_utils/test_serialization.py +++ b/celery/tests/test_utils/test_serialization.py @@ -3,11 +3,10 @@ import sys -from celery.tests.utils import unittest -from celery.tests.utils import mask_modules +from celery.tests.utils import Case, mask_modules -class TestAAPickle(unittest.TestCase): +class TestAAPickle(Case): def test_no_cpickle(self): prev = sys.modules.pop("celery.utils.serialization", None) diff --git a/celery/tests/test_utils/test_utils_encoding.py b/celery/tests/test_utils/test_utils_encoding.py index 2264fcb0a51..9448261c1f7 100644 --- a/celery/tests/test_utils/test_utils_encoding.py +++ b/celery/tests/test_utils/test_utils_encoding.py @@ -5,10 +5,10 @@ from nose import SkipTest from celery.utils import encoding -from celery.tests.utils import unittest +from celery.tests.utils import Case -class test_encoding(unittest.TestCase): +class test_encoding(Case): def test_safe_str(self): self.assertTrue(encoding.safe_str(object())) diff --git a/celery/tests/test_utils/test_utils_info.py b/celery/tests/test_utils/test_utils_info.py index 0c6735c63c9..bc707451430 100644 --- a/celery/tests/test_utils/test_utils_info.py +++ b/celery/tests/test_utils/test_utils_info.py @@ -2,7 +2,7 @@ from celery import Celery from celery.utils import textindent -from celery.tests.utils import unittest +from celery.tests.utils import Case RANDTEXT = """\ The quick brown @@ -32,7 +32,7 @@ QUEUE_FORMAT2 = """. queue2: exchange:exchange2 (type2) binding:bind2""" -class TestInfo(unittest.TestCase): +class TestInfo(Case): def test_textindent(self): self.assertEqual(textindent(RANDTEXT, 4), RANDTEXT_RES) diff --git a/celery/tests/test_utils/test_utils_timeutils.py b/celery/tests/test_utils/test_utils_timeutils.py index 8d023badfa5..81e72844cd9 100644 --- a/celery/tests/test_utils/test_utils_timeutils.py +++ b/celery/tests/test_utils/test_utils_timeutils.py @@ -3,10 +3,10 @@ from datetime import datetime, timedelta from celery.utils import timeutils -from celery.tests.utils import unittest +from celery.tests.utils import Case -class test_timeutils(unittest.TestCase): +class test_timeutils(Case): def test_delta_resolution(self): D = timeutils.delta_resolution diff --git a/celery/tests/test_worker/test_bootsteps.py b/celery/tests/test_worker/test_bootsteps.py index 09b8f85d320..982b46d8989 100644 --- a/celery/tests/test_worker/test_bootsteps.py +++ b/celery/tests/test_worker/test_bootsteps.py @@ -5,11 +5,10 @@ from celery import abstract -from celery.tests.utils import unittest -from celery.tests.utils import AppCase +from celery.tests.utils import AppCase, Case -class test_Component(unittest.TestCase): +class test_Component(Case): class Def(abstract.Component): name = "test_Component.Def" @@ -72,7 +71,7 @@ def test_include_when_disabled(self): self.assertFalse(x.create.call_count) -class test_StartStopComponent(unittest.TestCase): +class test_StartStopComponent(Case): class Def(abstract.StartStopComponent): name = "test_StartStopComponent.Def" diff --git a/celery/tests/test_worker/test_worker_autoscale.py b/celery/tests/test_worker/test_worker_autoscale.py index c2ce3cb5bf1..2039a785bbb 100644 --- a/celery/tests/test_worker/test_worker_autoscale.py +++ b/celery/tests/test_worker/test_worker_autoscale.py @@ -10,7 +10,7 @@ from celery.concurrency.base import BasePool from celery.worker import state from celery.worker import autoscale -from celery.tests.utils import unittest, sleepdeprived +from celery.tests.utils import Case, sleepdeprived logger = logging.getLogger("celery.tests.autoscale") @@ -43,7 +43,7 @@ def num_processes(self): return self._pool._processes -class test_Autoscaler(unittest.TestCase): +class test_Autoscaler(Case): def setUp(self): self.pool = MockPool(3) diff --git a/celery/tests/test_worker/test_worker_control.py b/celery/tests/test_worker/test_worker_control.py index 1151f27e549..62d718209f8 100644 --- a/celery/tests/test_worker/test_worker_control.py +++ b/celery/tests/test_worker/test_worker_control.py @@ -22,7 +22,7 @@ from celery.worker.state import revoked from celery.worker import control from celery.worker.control import Panel -from celery.tests.utils import unittest +from celery.tests.utils import Case hostname = socket.gethostname() @@ -57,7 +57,7 @@ def info(self): return {"xyz": "XYZ"} -class test_ControlPanel(unittest.TestCase): +class test_ControlPanel(Case): def setUp(self): self.app = current_app diff --git a/celery/tests/test_worker/test_worker_heartbeat.py b/celery/tests/test_worker/test_worker_heartbeat.py index 6b16eb9ba30..161b7afb5da 100644 --- a/celery/tests/test_worker/test_worker_heartbeat.py +++ b/celery/tests/test_worker/test_worker_heartbeat.py @@ -1,7 +1,7 @@ from __future__ import absolute_import from celery.worker.heartbeat import Heart -from celery.tests.utils import unittest, sleepdeprived +from celery.tests.utils import Case, sleepdeprived class MockDispatcher(object): @@ -45,7 +45,7 @@ def cancel(self, entry): entry.cancel() -class TestHeart(unittest.TestCase): +class TestHeart(Case): def test_stop(self): timer = MockTimer() diff --git a/celery/tests/test_worker/test_worker_mediator.py b/celery/tests/test_worker/test_worker_mediator.py index 47b49fc8cfe..7cd9c67bc75 100644 --- a/celery/tests/test_worker/test_worker_mediator.py +++ b/celery/tests/test_worker/test_worker_mediator.py @@ -9,7 +9,7 @@ from celery.utils import uuid from celery.worker.mediator import Mediator from celery.worker.state import revoked as revoked_tasks -from celery.tests.utils import unittest +from celery.tests.utils import Case class MockTask(object): @@ -29,7 +29,7 @@ def revoked(self): return False -class test_Mediator(unittest.TestCase): +class test_Mediator(Case): def test_mediator_start__stop(self): ready_queue = Queue() diff --git a/celery/tests/test_worker/test_worker_revoke.py b/celery/tests/test_worker/test_worker_revoke.py index a095b528b8c..8ae44fd1473 100644 --- a/celery/tests/test_worker/test_worker_revoke.py +++ b/celery/tests/test_worker/test_worker_revoke.py @@ -1,10 +1,10 @@ from __future__ import absolute_import from celery.worker import state -from celery.tests.utils import unittest +from celery.tests.utils import Case -class test_revoked(unittest.TestCase): +class test_revoked(Case): def test_is_working(self): state.revoked.add("foo") diff --git a/celery/tests/test_worker/test_worker_state.py b/celery/tests/test_worker/test_worker_state.py index 48b8689df3f..c7866212e27 100644 --- a/celery/tests/test_worker/test_worker_state.py +++ b/celery/tests/test_worker/test_worker_state.py @@ -2,10 +2,10 @@ from celery.datastructures import LimitedSet from celery.worker import state -from celery.tests.utils import unittest +from celery.tests.utils import Case -class StateResetCase(unittest.TestCase): +class StateResetCase(Case): def setUp(self): self.reset_state()