Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_cancel_decorated_callback(self):
"""Process Concurrent TaskCancelled is forwarded to callback."""
task = long_decorated_callback()
task.cancel()
event.wait()
self.assertTrue(isinstance(exception, TaskCancelled))
def test_thread_pool_cancel(self):
"""ThreadPoolDecorator callback gets notification if Task is cancelled."""
tjob_pool_long.callback = self.error_callback
task = tjob_pool_long(1, 1)
task.cancel()
event.wait()
self.assertTrue(isinstance(self.exception, TaskCancelled))
def test_cancel_decorated_callback(self):
"""Process Task TaskCancelled is forwarded to callback."""
task = long_decorated_callback()
task.cancel()
event.wait()
self.assertTrue(isinstance(exception, TaskCancelled))
def test_cancel_decorated(self):
"""Process Concurrent concurrent raises ConcurrentCancelled if so."""
task = long_decorated()
task.cancel()
self.assertRaises(TaskCancelled, task.get)
def test_thread_cancelled(self):
"""ThreadDecorator TaskCancelled is raised if task is cancelled."""
task = tjob_long()
task.cancel()
self.assertRaises(TaskCancelled, task.get)
def test_cancel_decorated(self):
"""Process Task task raises TaskCancelled if so."""
task = long_decorated()
task.cancel()
self.assertRaises(TaskCancelled, task.get)
def test_process_cancelled(self):
"""ProcessDecorator TaskCancelled is raised if task is cancelled."""
task = pjob_long()
task.cancel()
self.assertRaises(TaskCancelled, task.get)
def test_thread_pool_cancel(self):
"""Thread Pool task raises TaskCancelled if so."""
with thread.Pool() as pool:
task = pool.schedule(long_function)
task.cancel()
self.assertRaises(TaskCancelled, task.get)
def test_cancel_decorated(self):
"""Thread Task task raises TaskCancelled if so."""
task = long_decorated()
task.cancel()
self.assertRaises(TaskCancelled, task.get)
def test_cancel_decorated(self):
"""Thread Concurrent task raises TaskCancelled if so."""
task = long_decorated()
task.cancel()
self.assertRaises(TaskCancelled, task.get)