title: AssertionError on unit testing a celery task with autoretry, backoff and jitter
body: <p>Using celery 4.3.0. I tried to write a unit test for the following task.</p>
  
  <pre><code>    from django.core.exceptions import ObjectDoesNotExist
  
      @shared_task(autoretry_for=(ObjectDoesNotExist,), max_retries=5, retry_backoff=10)
      def process_something(data):
          product = Product()
          product.process(data)
  </code></pre>
  
  <p>Unit test:</p>
  
  <pre><code>@mock.patch('proj.tasks.Product')
  @mock.patch('proj.tasks.process_something.retry') 
  def test_process_something_retry_failed_task(self, process_something_retry, mock_product):
  
      mock_object = mock.MagicMock()
      mock_product.return_value = mock_object
      mock_object.process.side_effect = error = ObjectDoesNotExist()
  
      with pytest.raises(ObjectDoesNotExist):
          process_something(self.data)
  
      process_something_retry.assert_called_with(exc=error)
  </code></pre>
  
  <p>This is the error I get after running the test:</p>
  
  <pre><code>    @wraps(task.run)
      def run(*args, **kwargs):
          try:
              return task._orig_run(*args, **kwargs)
          except autoretry_for as exc:
              if retry_backoff:
                  retry_kwargs['countdown'] = \
                      get_exponential_backoff_interval(
                          factor=retry_backoff,
                          retries=task.request.retries,
                          maximum=retry_backoff_max,
                          full_jitter=retry_jitter)
  &gt;           raise task.retry(exc=exc, **retry_kwargs)
  E           TypeError: exceptions must derive from BaseException
  </code></pre>
  
  <p>I understand it is because of the exception. I replaced <code>ObjectDoesNotExist</code> everywhere with <code>Exception</code> instead. After running the test, I get this error:</p>
  
  <pre><code>    def assert_called_with(self, /, *args, **kwargs):
          """assert that the last call was made with the specified arguments.
  
              Raises an AssertionError if the args and keyword args passed in are
              different to the last call to the mock."""
          if self.call_args is None:
              expected = self._format_mock_call_signature(args, kwargs)
              actual = 'not called.'
              error_message = ('expected call not found.\nExpected: %s\nActual: %s'
                      % (expected, actual))
              raise AssertionError(error_message)
  
          def _error_message():
              msg = self._format_mock_failure_message(args, kwargs)
              return msg
          expected = self._call_matcher((args, kwargs))
          actual = self._call_matcher(self.call_args)
          if expected != actual:
              cause = expected if isinstance(expected, Exception) else None
  &gt;           raise AssertionError(_error_message()) from cause
  E           AssertionError: expected call not found.
  E           Expected: retry(exc=Exception())
  E           Actual: retry(exc=Exception(), countdown=7)
  </code></pre>
  
  <p>Please let me know how I can fix both the errors.</p>