-
Notifications
You must be signed in to change notification settings - Fork 34
refactor: always use multiprocess spawn #374
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
75c7dd6
to
7dc64f9
Compare
7dc64f9
to
73bd4d8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR refactors the multiprocessing implementation to always use the spawn context instead of platform-specific contexts, which addresses stability issues and ensures consistent behavior across platforms.
- Replaces platform-specific multiprocessing context selection with unified spawn context
- Consolidates MessageQueue implementation and moves it to the main module with proper manager support
- Removes unstable test marker and updates fixture dependencies
Reviewed Changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
File | Description |
---|---|
pytest-embedded/__init__.py |
Introduces centralized MP_CTX using spawn context and consolidated MessageQueue/MessageQueueManager classes |
pytest-embedded/plugin.py |
Updates fixture to use new MessageQueueManager and adds proper MessageQueue cleanup handling |
pytest-embedded/log.py |
Removes old MessageQueue implementation and platform-specific context, imports from main module |
pytest-embedded/dut_factory.py |
Updates imports and removes old context/queue generator functions |
pytest-embedded/dut.py |
Updates type hint to use proper MessageQueue type |
tests/test_base.py |
Removes xfail marker from previously unstable test |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
|
||
_b = to_bytes(obj) | ||
try: | ||
super().put(_b) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The put
method ignores the **kwargs
parameter when calling super().put(_b)
. This could break functionality that relies on timeout or blocking behavior. Should be super().put(_b, **kwargs)
.
super().put(_b) | |
super().put(_b, **kwargs) |
Copilot uses AI. Check for mistakes.
@@ -742,7 +733,8 @@ def create( | |||
layout = [] | |||
try: | |||
global PARAMETRIZED_FIXTURES_CACHE | |||
msg_queue = msg_queue_gn() | |||
|
|||
msg_queue = MessageQueueManager().MessageQueue() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Creating a new MessageQueueManager instance here will create an unmanaged queue that won't be properly cleaned up. This should use the session-scoped _mp_manager
fixture instead.
Copilot uses AI. Check for mistakes.
closes #294