From 1e72c45f317103bee20e00e66eff473ade40e33d Mon Sep 17 00:00:00 2001 From: J08nY Date: Thu, 27 Mar 2025 12:30:39 +0100 Subject: Move to loky for multiprocessing. --- test/misc/__init__.py | 0 test/misc/test_utils.py | 17 +++++++++++++++++ 2 files changed, 17 insertions(+) create mode 100644 test/misc/__init__.py create mode 100644 test/misc/test_utils.py (limited to 'test') diff --git a/test/misc/__init__.py b/test/misc/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/test/misc/test_utils.py b/test/misc/test_utils.py new file mode 100644 index 0000000..72ce711 --- /dev/null +++ b/test/misc/test_utils.py @@ -0,0 +1,17 @@ + +from pyecsca.misc.utils import TaskExecutor + + +def run(a, b): + return a + b + + +def test_executor(): + with TaskExecutor(max_workers=2) as pool: + for i in range(10): + pool.submit_task(i, + run, + i, 5) + for i, future in pool.as_completed(): + res = future.result() + assert res == i + 5 -- cgit v1.2.3-70-g09d2