Exemple #1
0
 def test_delayable(self):
     @task
     def foo(*args, **kwargs):
         # Assert that when it's called, it's beind delayed.
         assert kwargs['delivery_info']['is_eager']
     add(foo, 1)
     process()
Exemple #2
0
def index_addons(ids, **kw):
    # For the moment, only do this in the test suite.
    if settings.IN_TEST_SUITE:
        for pk in ids:
            add(index_addon_callback, pk)
    else:
        # We don't do a lot of multiple calls on requests, so let's just call
        # that normally.
        index_addon_callback(ids)
Exemple #3
0
def index_addons(ids, **kw):
    # For the moment, only do this in the test suite.
    if settings.IN_TEST_SUITE:
        for pk in ids:
            add(index_addon_callback, pk)
    else:
        # We don't do a lot of multiple calls on requests, so let's just call
        # that normally.
        index_addon_callback(ids)
Exemple #4
0
    def test_add(self):
        add(self.callback, 1)
        eq_(len(_locals.tasks), 1)
        add(self.callback, 1)
        eq_(len(_locals.tasks), 1)
        add(self.callback, 2)
        eq_(len(_locals.tasks), 2)

        callback = mock.Mock()
        callback.__name__ = 'bar'
        add(callback, 2)
        eq_(len(_locals.tasks), 3)
Exemple #5
0
def index_addon_held(ids, **kw):
    # Hold the indexes till the end of the request or until lib.es signal,
    # process is called.
    for pk in ids:
        add(index_addons, pk)
Exemple #6
0
def index_addon_held(ids, **kw):
    # Hold the indexes till the end of the request or until lib.es signal,
    # process is called.
    for pk in ids:
        add(index_addons, pk)
Exemple #7
0
 def test_request_finished(self):
     add(self.callback, 1)
     self.client.get('/')
     assert self.callback.called
Exemple #8
0
 def foo():
     add(self.callback, 1)
Exemple #9
0
 def test_context(self):
     with context.send():
         add(self.callback, 1)
     assert self.callback.called
Exemple #10
0
 def test_process_groups(self):
     add(self.callback, 1)
     add(self.callback, 4)
     process()
     eq_(set(self.callback.call_args[0][0]), set([1, 4]))
Exemple #11
0
 def test_process(self):
     add(self.callback, 1)
     process()
     assert self.callback.called
Exemple #12
0
 def test_reset(self):
     add(self.callback, 1)
     eq_(len(_locals.tasks), 1)
     reset()
     eq_(len(_locals.tasks), 0)