Example #1
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)
Example #2
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)
Example #3
0
 def foo():
     add(self.callback, 1)
Example #4
0
 def test_context(self):
     with context.send():
         add(self.callback, 1)
     assert self.callback.called
Example #5
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]))
Example #6
0
 def test_process(self):
     add(self.callback, 1)
     process()
     assert self.callback.called
Example #7
0
 def test_reset(self):
     add(self.callback, 1)
     eq_(len(_locals.tasks), 1)
     reset()
     eq_(len(_locals.tasks), 0)
Example #8
0
 def foo():
     add(self.callback, 1)
Example #9
0
 def test_context(self):
     with context.send():
         add(self.callback, 1)
     assert self.callback.called
Example #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]))
Example #11
0
 def test_process(self):
     add(self.callback, 1)
     process()
     assert self.callback.called
Example #12
0
 def test_reset(self):
     add(self.callback, 1)
     eq_(len(_locals.tasks), 1)
     reset()
     eq_(len(_locals.tasks), 0)