<h1 dir="auto">Checklist</h1>

<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> I have checked the <a href="https://github.com/celery/celery/issues?q=is%3Aissue+label%3A%22Issue+Type%3A+Enhancement%22+-label%3A%22Category%3A+Documentation%22">issues list</a><br>
for similar or identical enhancement to an existing feature.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> I have checked the <a href="https://github.com/celery/celery/pulls?q=is%3Apr+label%3A%22Issue+Type%3A+Enhancement%22+-label%3A%22Category%3A+Documentation%22">pull requests list</a><br>
for existing proposed enhancements.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> I have checked the <a href="https://github.com/celery/celery/commits/master">commit log</a><br>
to find out if the if the same enhancement was already implemented in the<br>
master branch.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> I have included all related issues and possible duplicate issues in this issue<br>
(If there are none, check this box anyway).</li>
</ul>
<h2 dir="auto">Related Issues and Possible Duplicates</h2>

<h4 dir="auto">Related Issues</h4>
<ul dir="auto">
<li>None</li>
</ul>
<h4 dir="auto">Possible Duplicates</h4>
<ul dir="auto">
<li>None</li>
</ul>
<h1 dir="auto">Brief Summary</h1>

<h1 dir="auto">Design</h1>
<h2 dir="auto">Architectural Considerations</h2>

<p dir="auto">None</p>
<h2 dir="auto">Proposed Behavior</h2>

<h2 dir="auto">Proposed UI/UX</h2>

<h2 dir="auto">Diagrams</h2>

<p dir="auto">N/A</p>
<h2 dir="auto">Alternatives</h2>

<p dir="auto">None</p>
<h2 dir="auto">Checklist</h2>
<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I have included the output of <code class="notranslate">celery -A proj report</code> in the issue.</li>
</ul>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="software -&gt; celery:4.2.0 (windowlicker) kombu:4.2.1 py:2.7.15
            billiard:3.5.0.3 py-amqp:2.3.2
platform -&gt; system:Linux arch:64bit imp:CPython
loader   -&gt; celery.loaders.app.AppLoader
settings -&gt; transport:amqp results:redis://redis:6379/0

task_create_missing_queues: True
task_routes: {
    'my_package.tasks.*': {   'queue': 'my_queue'}}
broker_url: u'amqp://guest:********@queue:5672//'
result_backend: u'redis://redis:6379/0'
task_track_started: True"><pre class="notranslate"><code class="notranslate">software -&gt; celery:4.2.0 (windowlicker) kombu:4.2.1 py:2.7.15
            billiard:3.5.0.3 py-amqp:2.3.2
platform -&gt; system:Linux arch:64bit imp:CPython
loader   -&gt; celery.loaders.app.AppLoader
settings -&gt; transport:amqp results:redis://redis:6379/0

task_create_missing_queues: True
task_routes: {
    'my_package.tasks.*': {   'queue': 'my_queue'}}
broker_url: u'amqp://guest:********@queue:5672//'
result_backend: u'redis://redis:6379/0'
task_track_started: True
</code></pre></div>
<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I have verified that the issue exists against the <code class="notranslate">master</code> branch of Celery.</li>
</ul>
<h2 dir="auto">Steps to reproduce</h2>
<p dir="auto">create a pytest test case that uses the <code class="notranslate">celery_worker</code> fixture:</p>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="@pytest.fixture()
def celery_worker_parameters():
    return {
        'queues': ('my_queue',),
        'exclude_queues': ('celery'),
    }

def test_my_task(celery_worker):
    pass"><pre class="notranslate"><span class="pl-en">@<span class="pl-s1">pytest</span>.<span class="pl-en">fixture</span>()</span>
<span class="pl-k">def</span> <span class="pl-en">celery_worker_parameters</span>():
    <span class="pl-k">return</span> {
        <span class="pl-s">'queues'</span>: (<span class="pl-s">'my_queue'</span>,),
        <span class="pl-s">'exclude_queues'</span>: (<span class="pl-s">'celery'</span>),
    }

<span class="pl-k">def</span> <span class="pl-en">test_my_task</span>(<span class="pl-s1">celery_worker</span>):
    <span class="pl-k">pass</span></pre></div>
<h2 dir="auto">Expected behavior</h2>
<p dir="auto">Task should have the celery_worker fixture present and run.</p>
<h2 dir="auto">Actual behavior</h2>
<p dir="auto">The test immediately fails with the following error and renders the terminal unresponsive.</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="request = &lt;SubRequest 'celery_worker' for &lt;Function 'test_my_task'&gt;&gt;, celery_app = &lt;Celery celery.tests at 0x7ff488539e50&gt;, celery_includes = (), celery_worker_pool = 'solo', celery_worker_parameters = {'exclude_queues': 'celery', 'queues': ('my_queue',)}

    @pytest.fixture()
    def celery_worker(request,
                      celery_app,
                      celery_includes,
                      celery_worker_pool,
                      celery_worker_parameters):
        # type: (Any, Celery, Sequence[str], str) -&gt; WorkController
        &quot;&quot;&quot;Fixture: Start worker in a thread, stop it when the test returns.&quot;&quot;&quot;
        if not NO_WORKER:
            for module in celery_includes:
                celery_app.loader.import_task_module(module)
            with worker.start_worker(celery_app,
                                     pool=celery_worker_pool,
&gt;                                    **celery_worker_parameters) as w:

/root/.local/share/virtualenvs/py-ITn23Csk/lib/python2.7/site-packages/celery/contrib/pytest.py:176: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/local/lib/python2.7/contextlib.py:17: in __enter__
    return self.gen.next()
/root/.local/share/virtualenvs/py-ITn23Csk/lib/python2.7/site-packages/celery/contrib/testing/worker.py:82: in start_worker
    assert ping.delay().get(timeout=ping_task_timeout) == 'pong'
/root/.local/share/virtualenvs/py-ITn23Csk/lib/python2.7/site-packages/celery/result.py:224: in get
    on_message=on_message,
/root/.local/share/virtualenvs/py-ITn23Csk/lib/python2.7/site-packages/celery/backends/async.py:190: in wait_for_pending
    return result.maybe_throw(callback=callback, propagate=propagate)
/root/.local/share/virtualenvs/py-ITn23Csk/lib/python2.7/site-packages/celery/result.py:329: in maybe_throw
    self.throw(value, self._to_remote_traceback(tb))
/root/.local/share/virtualenvs/py-ITn23Csk/lib/python2.7/site-packages/celery/result.py:322: in throw
    self.on_ready.throw(*args, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = &lt;promise@0x7ff487200b98 --&gt; &lt;bound method AsyncResult._on_fulfilled of &lt;AsyncResult: b6db7179-f73e-431c-941b-0d63acc190e3&gt;&gt;&gt;, exc = Task of kind u'celery.ping' never registered, please make sure it's imported., tb = None, propagate = True

    def throw(self, exc=None, tb=None, propagate=True):
        if not self.cancelled:
            current_exc = sys.exc_info()[1]
            exc = exc if exc is not None else current_exc
            try:
                self.throw1(exc)
                svpending = self._svpending
                if svpending is not None:
                    try:
                        svpending.throw1(exc)
                    finally:
                        self._svpending = None
                else:
                    lvpending = self._lvpending
                    try:
                        while lvpending:
                            lvpending.popleft().throw1(exc)
                    finally:
                        self._lvpending = None
            finally:
                if self.on_error is None and propagate:
                    if tb is None and (exc is None or exc is current_exc):
                        raise
&gt;                   reraise(type(exc), exc, tb)
E                   NotRegistered: u'celery.ping'"><pre class="notranslate"><code class="notranslate">request = &lt;SubRequest 'celery_worker' for &lt;Function 'test_my_task'&gt;&gt;, celery_app = &lt;Celery celery.tests at 0x7ff488539e50&gt;, celery_includes = (), celery_worker_pool = 'solo', celery_worker_parameters = {'exclude_queues': 'celery', 'queues': ('my_queue',)}

    @pytest.fixture()
    def celery_worker(request,
                      celery_app,
                      celery_includes,
                      celery_worker_pool,
                      celery_worker_parameters):
        # type: (Any, Celery, Sequence[str], str) -&gt; WorkController
        """Fixture: Start worker in a thread, stop it when the test returns."""
        if not NO_WORKER:
            for module in celery_includes:
                celery_app.loader.import_task_module(module)
            with worker.start_worker(celery_app,
                                     pool=celery_worker_pool,
&gt;                                    **celery_worker_parameters) as w:

/root/.local/share/virtualenvs/py-ITn23Csk/lib/python2.7/site-packages/celery/contrib/pytest.py:176: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/local/lib/python2.7/contextlib.py:17: in __enter__
    return self.gen.next()
/root/.local/share/virtualenvs/py-ITn23Csk/lib/python2.7/site-packages/celery/contrib/testing/worker.py:82: in start_worker
    assert ping.delay().get(timeout=ping_task_timeout) == 'pong'
/root/.local/share/virtualenvs/py-ITn23Csk/lib/python2.7/site-packages/celery/result.py:224: in get
    on_message=on_message,
/root/.local/share/virtualenvs/py-ITn23Csk/lib/python2.7/site-packages/celery/backends/async.py:190: in wait_for_pending
    return result.maybe_throw(callback=callback, propagate=propagate)
/root/.local/share/virtualenvs/py-ITn23Csk/lib/python2.7/site-packages/celery/result.py:329: in maybe_throw
    self.throw(value, self._to_remote_traceback(tb))
/root/.local/share/virtualenvs/py-ITn23Csk/lib/python2.7/site-packages/celery/result.py:322: in throw
    self.on_ready.throw(*args, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = &lt;promise@0x7ff487200b98 --&gt; &lt;bound method AsyncResult._on_fulfilled of &lt;AsyncResult: b6db7179-f73e-431c-941b-0d63acc190e3&gt;&gt;&gt;, exc = Task of kind u'celery.ping' never registered, please make sure it's imported., tb = None, propagate = True

    def throw(self, exc=None, tb=None, propagate=True):
        if not self.cancelled:
            current_exc = sys.exc_info()[1]
            exc = exc if exc is not None else current_exc
            try:
                self.throw1(exc)
                svpending = self._svpending
                if svpending is not None:
                    try:
                        svpending.throw1(exc)
                    finally:
                        self._svpending = None
                else:
                    lvpending = self._lvpending
                    try:
                        while lvpending:
                            lvpending.popleft().throw1(exc)
                    finally:
                        self._lvpending = None
            finally:
                if self.on_error is None and propagate:
                    if tb is None and (exc is None or exc is current_exc):
                        raise
&gt;                   reraise(type(exc), exc, tb)
E                   NotRegistered: u'celery.ping'
</code></pre></div>