Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
@process.concurrent
def critical_decorated():
os._exit(123)
@process(timeout=2)
def pjob_long_timeout():
return 1
def test_process_pool_queue_factory(self):
"""Process Pool queue factory is called."""
with process.Pool(queue_factory=queue_factory) as pool:
self.assertEqual(pool._context.task_queue.maxsize, 5)
@process(callback=callback)
def pjob_callback(argument, keyword_argument=0):
return argument + keyword_argument
@process.spawn(name='foo')
def decorated_kword(queue, argument, keyword_argument=0):
"""A docstring."""
queue.put(argument + keyword_argument)
def test_process_pool_broken_initializer(self):
"""Process Pool broken initializer is notified."""
with self.assertRaises(PoolError):
with pebble.process.Pool(initializer=broken_initializer) as pool:
pool.schedule(function)
@process
def pjob_error(argument, keyword_argument=0):
raise Exception("BOOM!")
def tearDown(self):
pebble.process.pool.worker_process = self.worker_process
pebble.process.channel.LOCK_TIMEOUT = 60
def test_process_pool_error(self):
"""Process Pool errors are raised by task get."""
with process.Pool() as pool:
task = pool.schedule(error_function)
self.assertRaises(Exception, task.get)