pycroglia.core.compute.tests.unit package
Submodules
- class pycroglia.core.compute.tests.unit.test_mp_pool.DummyComputable(cell_id, should_fail=False)[source]
Bases:
ComputableSimple computable used for testing the Pool.
- Parameters:
- compute()[source]
Run a dummy computation.
- Returns:
Dictionary with cell_id and computed value.
- Return type:
- Raises:
ValueError – If should_fail is True.
- pycroglia.core.compute.tests.unit.test_mp_pool.test_all_finished_emitted_once()[source]
Test Pool emits all_finished exactly once.
- Asserts:
The all_finished callback is executed only once, even when multiple tasks are submitted to the pool.
- pycroglia.core.compute.tests.unit.test_mp_pool.test_multiple_tasks_success()[source]
Test Pool correctly executes multiple tasks in parallel.
- Asserts:
The result callback is called for each task. Each finish callback is invoked with the corresponding task ID. The all_finished callback is executed once all tasks complete.
- pycroglia.core.compute.tests.unit.test_mp_pool.test_pool_cancellation()[source]
Test that Pool cancels all running tasks cooperatively.
- Asserts:
Tasks running before cancellation finish normally. Pending tasks do not start after cancellation. The result callback is only called for completed tasks. The finish callback is invoked for each submitted task. The all_finished callback is executed once after cancellation. The internal tasks list is cleared when all tasks have finished or been cancelled.
- pycroglia.core.compute.tests.unit.test_mp_pool.test_single_task_success()[source]
Test Pool correctly executes a single task.
- Asserts:
The result callback receives the correct dictionary. The finish callback is invoked with the task ID. The all_finished callback is executed after completion.
- pycroglia.core.compute.tests.unit.test_mp_pool.test_task_failure_triggers_error()[source]
Test Pool correctly propagates computation errors.
- Asserts:
The error callback is called with the raised exception. The result callback is not invoked when computation fails. The finish callback is still invoked for the task. The all_finished callback is executed after error handling.
- class pycroglia.core.compute.tests.unit.test_qt_pool.DummyComputable(cell_id, should_fail=False)[source]
Bases:
ComputableSimple computable used for testing the Pool.
- Parameters:
- compute()[source]
Run a dummy computation.
- Returns:
Dictionary with cell_id and computed value.
- Return type:
- Raises:
ValueError – If should_fail is True.
- pycroglia.core.compute.tests.unit.test_qt_pool.test_all_finished_emitted_once(qtbot)[source]
Test Pool emits all_finished exactly once.
- Asserts:
The all_finished signal is emitted only once, even when multiple tasks are submitted to the pool.
- pycroglia.core.compute.tests.unit.test_qt_pool.test_multiple_tasks_success(qtbot)[source]
Test Pool correctly executes multiple tasks in parallel.
- Asserts:
The result callback is called for each task. Each finish callback is invoked with the corresponding task ID. The all_finished signal is emitted once all tasks complete.
- pycroglia.core.compute.tests.unit.test_qt_pool.test_pool_cancellation(qtbot)[source]
Test that QPool cooperatively cancels running tasks.
- Asserts:
Tasks running before cancellation are skipped after flag is set. No results are emitted after cancellation. The finish callback is invoked for all submitted tasks. The all_finished signal is emitted once after cancellation. The internal tasks list is cleared after all finishes.
- pycroglia.core.compute.tests.unit.test_qt_pool.test_single_task_success(qtbot)[source]
Test Pool correctly executes a single task.
- Asserts:
The result callback receives the correct dictionary. The finish callback is invoked with the task ID. The all_finished signal is emitted after completion.
- pycroglia.core.compute.tests.unit.test_qt_pool.test_task_failure_triggers_error(qtbot)[source]
Test Pool correctly propagates computation errors.
- Asserts:
The error callback is called with the raised exception. The result callback is not invoked when computation fails. The finish callback is still invoked for the task. The all_finished signal is emitted after error handling.