From a84d1162ec6b5ed6c33dbea0e8a5a28a82b677a8 Mon Sep 17 00:00:00 2001 From: Andras Schmelczer Date: Sun, 3 Jul 2022 14:56:01 +0200 Subject: [PATCH] Try fixing test --- .github/workflows/test.yml | 4 ++-- .../utilities/parallel_map/parallel_map.py | 1 + tests/utilities/test_parallel_map.py | 14 +++++++------- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 0bb8b34..c283e94 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -28,7 +28,7 @@ jobs: - name: Install dependencies run: | python3 -m pip install --upgrade pip setuptools pytest pytest-cov pytest-subtests pytest-asyncio - pip install . + pip install --upgrade . - name: Check code and formatting run: scripts/check-python.sh . @@ -56,7 +56,7 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - pip install . + pip install --upgrade . rm -rf build - name: Download test results diff --git a/src/great_ai/utilities/parallel_map/parallel_map.py b/src/great_ai/utilities/parallel_map/parallel_map.py index 7ce61ff..9934046 100644 --- a/src/great_ai/utilities/parallel_map/parallel_map.py +++ b/src/great_ai/utilities/parallel_map/parallel_map.py @@ -100,6 +100,7 @@ def parallel_map( ctx.Process( name=f"parallel_map_{config.function_name}_{i}", target=mapper_function, + daemon=True, kwargs=dict( input_queue=input_queue, output_queue=output_queue, diff --git a/tests/utilities/test_parallel_map.py b/tests/utilities/test_parallel_map.py index 99c5260..07a14c8 100644 --- a/tests/utilities/test_parallel_map.py +++ b/tests/utilities/test_parallel_map.py @@ -87,15 +87,15 @@ class TestParallelMap(unittest.TestCase): ) ) == [1, 4, 9] - # def test_worker_process_exception(self) -> None: - # def oh_no(_): - # raise ValueError("hi") + def test_worker_process_exception(self) -> None: + def oh_no(_): + raise ValueError("hi") - # with pytest.raises(ValueError): - # list(parallel_map(oh_no, range(COUNT), concurrency=2)) + with pytest.raises(ValueError): + list(parallel_map(oh_no, range(COUNT), concurrency=2)) - # with pytest.raises(ValueError): - # list(parallel_map(oh_no, range(COUNT), concurrency=1)) + with pytest.raises(ValueError): + list(parallel_map(oh_no, range(COUNT), concurrency=1)) def test_ignore_worker_process_exception(self) -> None: def oh_no(_):