From 05d70e346c126145ad0c8130cca593ebb6d7a604 Mon Sep 17 00:00:00 2001 From: Hhhilulu <115983968+Hhhilulu@users.noreply.github.com> Date: Wed, 8 Nov 2023 14:44:08 +0800 Subject: [PATCH] [PromptFlow][TestCase] Fix test case to enable them passable in different systems. (#1038) # Description To enable test cases to work on different systems(win, mac, linux), set the process start method to spawn. # All Promptflow Contribution checklist: - [ ] **The pull request does not introduce [breaking changes].** - [ ] **CHANGELOG is updated for new features, bug fixes or other significant changes.** - [ ] **I have read the [contribution guidelines](../CONTRIBUTING.md).** - [ ] **Create an issue and link to the pull request to get dedicated review from promptflow team. Learn more: [suggested workflow](../CONTRIBUTING.md#suggested-workflow).** ## General Guidelines and Best Practices - [ ] Title of the pull request is clear and informative. - [ ] There are a small number of commits, each of which have an informative message. This means that previously merged commits do not appear in the history of the PR. For more information on cleaning up the commits in your PR, [see this page](https://github.com/Azure/azure-powershell/blob/master/documentation/development-docs/cleaning-up-commits.md). ### Testing Guidelines - [ ] Pull request includes test coverage for the included changes. --- .../unittests/processpool/test_healthy_ensured_process.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/promptflow/tests/executor/unittests/processpool/test_healthy_ensured_process.py b/src/promptflow/tests/executor/unittests/processpool/test_healthy_ensured_process.py index 498f1bbf7db..42fe462c060 100644 --- a/src/promptflow/tests/executor/unittests/processpool/test_healthy_ensured_process.py +++ b/src/promptflow/tests/executor/unittests/processpool/test_healthy_ensured_process.py @@ -27,7 +27,7 @@ def end_process(healthy_ensured_process): class TestHealthyEnsuredProcess: def test_healthy_ensured_process(self): - context = get_multiprocessing_context("fork") + context = get_multiprocessing_context("spawn") healthy_ensured_process = HealthyEnsuredProcess(executor_creation_func, context) assert healthy_ensured_process.is_ready is False task_queue = Queue() @@ -38,7 +38,7 @@ def test_healthy_ensured_process(self): assert healthy_ensured_process.process.is_alive() is False def test_unhealthy_process(self): - context = get_multiprocessing_context("fork") + context = get_multiprocessing_context("spawn") healthy_ensured_process = HealthyEnsuredProcess(executor_creation_func_timeout, context) assert healthy_ensured_process.is_ready is False task_queue = Queue() @@ -49,7 +49,7 @@ def test_unhealthy_process(self): assert healthy_ensured_process.process.is_alive() is False def test_format_current_process(self): - context = get_multiprocessing_context("fork") + context = get_multiprocessing_context("spawn") healthy_ensured_process = HealthyEnsuredProcess(executor_creation_func, context) healthy_ensured_process.process = patch( 'promptflow.executor._line_execution_process_pool.Process', autospec=True) @@ -66,7 +66,7 @@ def test_format_current_process(self): @patch('promptflow.executor._line_execution_process_pool.logger.info', autospec=True) def test_format_completed_process(self, mock_logger_info): - context = get_multiprocessing_context("fork") + context = get_multiprocessing_context("spawn") healthy_ensured_process = HealthyEnsuredProcess(executor_creation_func, context) healthy_ensured_process.process = patch( 'promptflow.executor._line_execution_process_pool.Process', autospec=True)