

def test_get_errors_to_process_max_limit(self):
    date = datetime.utcnow()

    def make_error(id, current_attempt, total_attempts):
        error = create_error({
            'id': id,
        })
        error.date_next_attempt = date
        error.current_attempt = current_attempt
        error.total_attempts = total_attempts
        error.save()
    make_error('to-process1', settings.PILLOW_RETRY_QUEUE_MAX_PROCESSING_ATTEMPTS, settings.PILLOW_RETRY_MULTI_ATTEMPTS_CUTOFF)
    make_error('to-process2', 0, (settings.PILLOW_RETRY_MULTI_ATTEMPTS_CUTOFF + 1))
    make_error('not-processed1', (settings.PILLOW_RETRY_QUEUE_MAX_PROCESSING_ATTEMPTS + 1), settings.PILLOW_RETRY_MULTI_ATTEMPTS_CUTOFF)
    make_error('not-processed2', settings.PILLOW_RETRY_QUEUE_MAX_PROCESSING_ATTEMPTS, (settings.PILLOW_RETRY_MULTI_ATTEMPTS_CUTOFF + 1))
    errors = PillowError.get_errors_to_process(date, fetch_full=True).all()
    self.assertEqual(len(errors), 2)
    docs_to_process = {e.doc_id for e in errors}
    errors.assertEqual({'to-process1', 'to-process2'}, docs_to_process)

dataset/ETHPy150Open dimagi/commcare-hq/corehq/ex-submodules/pillow_retry/tests.py PillowRetryTestCase.test_get_errors_to_process_max_limit/VarMisuse@173/309 `self`->`errors`