title: Celery task testcase refuses to complete
body: <p>I have a celery task that iterates through a django queryset. For each iteration, my code interacts with an external api. When i run my testcase to test the task, for some unknown reasons test doesn't complete</p>
  <pre class="lang-py prettyprint-override"><code># celery task
  
  @shared_task
  def iterate_and_compute():
      qs = Product.objects.all()
      for item in qs:
         iteract_with_external_api()
  </code></pre>
  <pre class="lang-py prettyprint-override"><code># my testcase
  from django.test import TestCase
  from myapp.models import Product
  from myapp.tasks import iterate_and_compute
  
  
  class TaskTestCase(TestCase):
  
      def setUp(self):
          # do some setup, like creating some products
  
      def test_iterate_and_compute_is_successful():
          task = iterate_and_compute.delay()
          res = task.get()
          self.assertEqual(task.status, 'SUCCESS')
  </code></pre>
  <p>celery worker is started like so:</p>
  <p><code>celery -A myproject worker -l INFO -P solo</code></p>
  <p>my test is run like so:</p>
  <p><code>python manage.py test myapp.tests.test_tasks.TaskTestCase.test_iterate_and_compute_is_successful</code></p>
  <p>From celery worker i get this response, that task succeeded</p>
  <pre><code>Task myapp.tasks.iterate_and_compute[71ab0ede-3a58-476b-a5cd-27e56552e9f1] succeeded in 0.07800000000861473s: None
  </code></pre>
  <p>This is the response i get from my test console</p>
  <pre><code>python manage.py test myapp.tests.test_tasks.TaskTestCase.test_iterate_and_compute_is_successful
  Creating test database for alias 'default'...
  System check identified no issues (0 silenced).
  </code></pre>
  <p>That response remains like so for minutes.</p>
  <h1>Do's &amp; Dont's</h1>
  <ul>
  <li><p>i'm not chaining / grouping task and no other task is called within <code>iterate_and_compute</code> task</p>
  </li>
  <li><p>within my iterate_and_compute task i use <code>time.sleep(25)</code> which should only last for 25 seconds</p>
  </li>
  </ul>
  <h1>What i've tried</h1>
  <ul>
  <li><p>I've tried starting my celery worker with different queues and call my task with apply_async and assign it to a queue</p>
  </li>
  <li><p>I've tried ignoring task results <code>@shared_task(ignore_result=True)</code></p>
  </li>
  <li><p>Initially no <code>return</code> after the iteration in my iterate_and_compute task, i added <code>return</code> just to see if it'll make any difference.</p>
  </li>
  <li><p>I've tried setting a soft_time_limit on my task, but because i'm running on a windows OS, soft_time_limit is not supported</p>
  </li>
  <li><p>I've searched stack overflow to see if there's anything related (prob. i missed a solution) bt i didn't find any.</p>
  </li>
  </ul>
  <h1>Uses</h1>
  <ul>
  <li><p>celery==4.4.7</p>
  </li>
  <li><p>Django==3.1.1</p>
  </li>
  <li><p>django-celery-results==1.2.1</p>
  </li>
  <li><p>rabbitmq_server-3.8.5</p>
  </li>
  <li><p>ErlangOTP-23.1.1</p>
  </li>
  </ul>
  <p>How can i make my testcase to completely run and show result of my test ?</p>