Skip to content

Commit

Permalink
[PromptFlow][TestCase] Fix test case to enable them passable in diffe…
Browse files Browse the repository at this point in the history
…rent 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.
  • Loading branch information
Hhhilulu authored and zhengfeiwang committed Nov 8, 2023
1 parent bf30609 commit 05d70e3
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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()
Expand All @@ -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)
Expand All @@ -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)
Expand Down

0 comments on commit 05d70e3

Please sign in to comment.