<commit_before>from twisted.python import log
from twisted.internet.task import Clock
from twisted.trial.unittest import TestCase
from twisted.internet.defer import (
    inlineCallbacks, returnValue, DeferredQueue, Deferred)

from vumi_http_retry.workers.sender.worker import RetrySenderWorker
from vumi_http_retry.retries import pending_key, ready_key, add_ready
from vumi_http_retry.tests.redis import zitems, lvalues, delete
from vumi_http_retry.tests.utils import ToyServer


class TestRetrySenderWorker(TestCase):
    timeout = 1
    @inlineCallbacks
    def teardown_worker(self, worker):
        yield delete(worker.redis, 'test.*')
        yield worker.teardown()

    @inlineCallbacks
    def mk_worker(self, config=None):
        if config is None:
            config = {}

        config['redis_prefix'] = 'test'
        config.setdefault('overrides', {}).update({'persistent': False})

        worker = RetrySenderWorker(config)
        yield worker.setup(Clock())
        self.addCleanup(self.teardown_worker, worker)

        returnValue(worker)

    def patch_retry(self):
        reqs = DeferredQueue()

        def retry(req):
            reqs.put(req)

        self.patch(RetrySenderWorker, 'retry', staticmethod(retry))<commit_msg>Remove stray timeout debug line<commit_after>from twisted.python import log
from twisted.internet.task import Clock
from twisted.trial.unittest import TestCase
from twisted.internet.defer import (
    inlineCallbacks, returnValue, DeferredQueue, Deferred)

from vumi_http_retry.workers.sender.worker import RetrySenderWorker
from vumi_http_retry.retries import pending_key, ready_key, add_ready
from vumi_http_retry.tests.redis import zitems, lvalues, delete
from vumi_http_retry.tests.utils import ToyServer


class TestRetrySenderWorker(TestCase):
    @inlineCallbacks
    def teardown_worker(self, worker):
        yield delete(worker.redis, 'test.*')
        yield worker.teardown()

    @inlineCallbacks
    def mk_worker(self, config=None):
        if config is None:
            config = {}

        config['redis_prefix'] = 'test'
        config.setdefault('overrides', {}).update({'persistent': False})

        worker = RetrySenderWorker(config)
        yield worker.setup(Clock())
        self.addCleanup(self.teardown_worker, worker)

        returnValue(worker)

    def patch_retry(self):
        reqs = DeferredQueue()

        def retry(req):
            reqs.put(req)

        self.patch(RetrySenderWorker, 'retry', staticmethod(retry))
{'fraction_non_alphanumeric': 0.09225239616613419, 'fraction_numerical': 0.00039936102236421724, 'mean_word_length': 3.621771217712177, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '930343', 'n_tokens_mistral': 738, 'n_tokens_neox': 735, 'n_words': 167}