1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
|
import operator
import pytest
from celery.utils.functional import noop
class test_thread_TaskPool:
def test_on_apply(self):
from celery.concurrency import thread
x = thread.TaskPool()
try:
x.on_apply(operator.add, (2, 2), {}, noop, noop)
finally:
x.stop()
def test_info(self):
from celery.concurrency import thread
x = thread.TaskPool()
try:
assert x.info
finally:
x.stop()
def test_on_stop(self):
from celery.concurrency import thread
x = thread.TaskPool()
x.on_stop()
with pytest.raises(RuntimeError):
x.on_apply(operator.add, (2, 2), {}, noop, noop)
|