Fix pytest-xdist serialization issue with workflow-embedded version pinning #223
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The CI tests were failing with serialization errors when using pytest-xdist for parallel test execution:
This error occurred in both the "Verify module" and "Test functions" workflows, causing complete test failures despite the underlying tests being valid.
Root Cause
The issue was caused by an incompatibility between the latest versions of:
When pytest-rerunfailures tries to serialize
ExceptionInfoobjects for communication between pytest-xdist worker processes, the objects cannot be serialized by execnet, causing internal errors.Solution
This PR implements version pinning directly in workflow files using battle-tested compatible versions:
Updated 6 workflows with embedded version constraints
verify-module.yml✅test-functions.yml✅test-functions-python313.yml✅test-pip.yml✅measure-coverage.yml✅run-examples.yml✅Each workflow now installs pytest dependencies with compatible versions:
pip install "pytest>=7.4.0,<8.0.0" "pytest-xdist>=3.3.0,<4.0.0" "pytest-rerunfailures>=11.1,<12.0"Benefits
-n autorestored for better CI performance@pytest.mark.flaky(reruns=X)functionality maintainedThe solution completely resolves the serialization failures while maintaining all existing testing capabilities and improving overall CI reliability.
Fixes #222.
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.