You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fix pytest CI matrix compatibility and prevent hangs (microsoft#26027)
## Summary
Fix the Python test matrix so every job runs its requested pytest
version, cover supported Python versions against recent and upcoming
pytest releases, remove the obsolete global pytest pin, and prevent
subprocess failures from hanging CI indefinitely.
## Root cause
`pytest-black==0.6.0` uses the deprecated `pytest_collect_file(path,
...)` hook removed by pytest 8.1. The resulting `pytest<8.1` workaround
lived in shared test requirements, which were installed after the
matrix-selected pytest version and silently downgraded stable and
pre-release jobs to pytest 8.0.2.
The downgrade also made the manual pytest-cov test reject
`--disable-plugin-autoload`. Its subprocess exited, but the named-pipe
listener waited indefinitely, causing the multi-hour CI hangs.
## Test matrix
On Ubuntu and Windows:
- Python 3.10, 3.11, 3.12, 3.13, and 3.14
- Latest pytest 8.4 patch (`pytest==8.4.*`) for approximately one year
of compatibility coverage
- Pytest pre-release channel to catch upcoming breaking changes
This produces 20 jobs. The 8.4 wildcard currently resolves to pytest
8.4.2.
## Changes
- Install shared test requirements before matrix-selected pytest.
- Remove `pytest<8.1` and `pytest-black` from shared requirements.
- Skip the obsolete pytest-black-specific discovery case; pytest-ruff
continues to cover plugin-generated test items.
- Explicitly install stable pytest in the build workflow.
- Use `PYTEST_DISABLE_PLUGIN_AUTOLOAD` for cross-version manual plugin
loading.
- Bound subprocess and pipe waits and propagate failures promptly.
- Add regression tests for subprocess timeout, failure propagation, and
pipe timeout.
## Validation
- Python 3.10 / pytest 8.4.2: **219 passed, 1 skipped**
- Python 3.13 / pytest 9.1.1: **219 passed, 1 skipped**
- Ruff checks and `git diff --check` pass.
---------
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: eleanorjboyd <26030610+eleanorjboyd@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
0 commit comments