Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Sep 1, 2025

The CI tests were failing with serialization errors when using pytest-xdist for parallel test execution:

INTERNALERROR> execnet.gateway_base.DumpError: can't serialize <class '_pytest._code.code.ExceptionInfo'>

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:

  • pytest (8.4.1)
  • pytest-xdist (3.8.0)
  • pytest-rerunfailures (16.0)

When pytest-rerunfailures tries to serialize ExceptionInfo objects 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

  • Re-enables parallel testing: -n auto restored for better CI performance
  • Preserves flaky test retries: @pytest.mark.flaky(reruns=X) functionality maintained
  • Prevents future issues: Version constraints prevent incompatible upgrades
  • Clean implementation: No external config files, all constraints embedded in workflows
  • Improves consistency: All workflows use the same tested dependency versions

The 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.

Copilot AI self-assigned this Sep 1, 2025
Copy link
Contributor Author

Copilot AI commented Sep 1, 2025

@toruseo 👋 This repository doesn't have Copilot instructions. With Copilot instructions, I can understand the repository better, work faster and produce higher quality PRs.

I can generate a .github/copilot-instructions.md file for you automatically. Click here to open a pre-filled issue and assign it to me. I'll write the instructions, and then tag you for review.

Copilot AI and others added 3 commits September 1, 2025 04:06
…ration

Co-authored-by: toruseo <34780089+toruseo@users.noreply.github.com>
Co-authored-by: toruseo <34780089+toruseo@users.noreply.github.com>
Copilot AI changed the title [WIP] CI: pytest fail due to unknown external reasons Fix pytest-xdist serialization issue with version pinning and configuration Sep 1, 2025
Copilot AI requested a review from toruseo September 1, 2025 04:09
@toruseo
Copy link
Owner

toruseo commented Sep 1, 2025

@copilot please dont create new files. just update .yml files only.

Co-authored-by: toruseo <34780089+toruseo@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Sep 1, 2025

@copilot please dont create new files. just update .yml files only.

Removed all external config files (test-requirements.txt, pytest.ini, PYTEST_FIX.md, test_pytest_compatibility.py, SOLUTION_SUMMARY.md) and updated only the .yml workflow files with direct pytest version constraints. The pytest dependencies are now specified inline in each workflow. (bd46363)

Copilot AI changed the title Fix pytest-xdist serialization issue with version pinning and configuration Fix pytest-xdist serialization issue with workflow-embedded version pinning Sep 1, 2025
@toruseo toruseo marked this pull request as ready for review September 1, 2025 04:38
@toruseo toruseo merged commit 22ea186 into main Sep 1, 2025
15 checks passed
@toruseo toruseo deleted the copilot/fix-222 branch September 1, 2025 04:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CI: pytest fail due to unknown external reasons

2 participants