latest.ipv8.test.test_taskmanager

Module Contents

Classes

TestTaskManager

Tests related to the task manager.

class latest.ipv8.test.test_taskmanager.TestTaskManager

Bases: latest.ipv8.test.base.TestBase

Tests related to the task manager.

setUp() None

Create a task manager.

async tearDown() None

Shut down the task manager.

count() None

A function used to increment the local counter.

set_counter(value: int) None

Set the testing counter to a fixed value.

test_call_later() None

Check that tasks can be sheduled for the future.

test_call_later_and_cancel() None

Check that scheduled tasks can be canceled.

async test_replace_with_duplicate() None

Check that a scheduled task can be overwritten by name, cancelling the previous task.

async test_replace_without_duplicate() None

Check that replacing without a running task with the same name simply registers the task.

async test_replace_with_error() None

Check that a task with faulty arguments raises a TypeError when replaced.

test_looping_call() None

Check that repeating calls can be registered.

test_looping_call_and_cancel() None

Check that repeating calls can be cancelled.

test_delayed_looping_call_requires_coroutine() None

Check that delayed calls cannot be futures.

test_delayed_looping_call_register_and_cancel_pre_delay() None

Check that a delayed repeating call can be cancelled.

async test_delayed_looping_call_register_wait_and_cancel() None

Check if interval tasks are actually properly called.

test_raise_on_duplicate_task_name() None

Check that a normal register task cannot be used as a replace task.

test_duplicate_anon_task() None

Tests that anonymous tasks allow the same base name to be reused.

async test_shutdown() None

Check if the TaskManager does not allow new tasks after shutdown().

async test_cleanup() None

Check if the tasks are cleaned up after the cleanup frequency has been met.

async test_cleanup_remaining() None

Check if tasks which have yet to complete are not cleaned.

async test_task_with_exception() None

Check if tasks forward their exceptions properly.

async test_task_with_exception_ignore() None

Check that ignored exceptions do not end up in the main/generic exception handler.

Note that they are still locally raised!

async test_task_decorator_coro() None

Check that the task decorator allows functions to be wrapped.

test_task_decorator_no_coro() None

Check if an attempt to taskify a non-async function raises a TypeError.

async test_register_task_with_future() None

Check if registering a Future works.

async test_cancel_future() None

Check if cancelling a Future works.

async test_register_executor_task() None

Check if registering an executor task works.

async test_register_executor_task_anon() None

Check if registering anonymous executor tasks work.

async test_get_task_existing_pending() None

Check if an existing pending task can be retrieved.

async test_get_task_existing_finished() None

Check if an existing finished task can be retrieved.

test_get_task_non_existent() None

Check if retrieving an unknown task returns None.

async test_get_anon_tasks_existing_pending() None

Check if existing pending anonymous tasks can be retrieved.

async test_get_anon_tasks_existing_finished() None

Check if existing finished anonymous tasks can be retrieved.

test_get_anon_tasks_non_existent() None

Check if retrieving anonymous tasks with an unknown base name returns an empty list.