예제 #1
0
 def test_on_apply(self):
     with mock.module("threadpool"):
         x = TaskPool(app=self.app)
         x.on_start()
         callback = Mock()
         accept_callback = Mock()
         target = Mock()
         req = x.on_apply(target, args=(1, 2), kwargs={"a": 10}, callback=callback, accept_callback=accept_callback)
         x.WorkRequest.assert_called_with(apply_target, (target, (1, 2), {"a": 10}, callback, accept_callback))
         x._pool.putRequest.assert_called_with(req)
         x._pool._results_queue.queue.clear.assert_called_with()
예제 #2
0
 def test_on_apply(self):
     with mock_module('threadpool'):
         x = TaskPool(app=self.app)
         x.on_start()
         callback = Mock()
         accept_callback = Mock()
         target = Mock()
         req = x.on_apply(target, args=(1, 2), kwargs={'a': 10},
                          callback=callback,
                          accept_callback=accept_callback)
         x.WorkRequest.assert_called_with(
             apply_target,
             (target, (1, 2), {'a': 10}, callback, accept_callback),
         )
         x._pool.putRequest.assert_called_with(req)
         x._pool._results_queue.queue.clear.assert_called_with()
예제 #3
0
 def test_on_stop(self):
     with mock.module('threadpool'):
         x = TaskPool(app=self.app)
         x.on_start()
         x.on_stop()
         x._pool.dismissWorkers.assert_called_with(x.limit, do_join=True)
예제 #4
0
 def test_on_start(self):
     with mock.module('threadpool'):
         x = TaskPool(app=self.app)
         x.on_start()
         self.assertTrue(x._pool)
         self.assertIsInstance(x._pool.workRequests, NullDict)
예제 #5
0
 def test_on_stop(self):
     with mock_module('threadpool'):
         x = TaskPool()
         x.on_start()
         x.on_stop()
         x._pool.dismissWorkers.assert_called_with(x.limit, do_join=True)
예제 #6
0
 def test_on_start(self):
     with mock_module('threadpool'):
         x = TaskPool()
         x.on_start()
         self.assertTrue(x._pool)
         self.assertIsInstance(x._pool.workRequests, NullDict)
예제 #7
0
 def test_on_stop(self):
     with mock_module("threadpool"):
         x = TaskPool()
         x.on_start()
         x.on_stop()
         x._pool.dismissWorkers.assert_called_with(x.limit, do_join=True)
예제 #8
0
 def test_on_start(self):
     with mock_module("threadpool"):
         x = TaskPool()
         x.on_start()
         self.assertTrue(x._pool)
         self.assertIsInstance(x._pool.workRequests, NullDict)
예제 #9
0
 def test_on_stop(self):
     with mock.module("threadpool"):
         x = TaskPool(app=self.app)
         x.on_start()
         x.on_stop()
         x._pool.dismissWorkers.assert_called_with(x.limit, do_join=True)
예제 #10
0
 def test_on_start(self):
     with mock.module("threadpool"):
         x = TaskPool(app=self.app)
         x.on_start()
         self.assertTrue(x._pool)
         self.assertIsInstance(x._pool.workRequests, NullDict)