Fix Python 3.14 compatiblity
β What kind of change does this PR introduce?
- [x] π bug fix
- [ ] π£ feature
- [ ] π docs update
- [ ] π tests/coverage improvement
- [ ] π refactoring
- [ ] π₯ other
π What is the related issue number (starting with #)
Resolves #767
β What is the current behavior? (You can also link to an open issue here)
Python 3.14 tests fail in CI with:
- Multiprocessing errors due to default start method change from
forktoforkserveron Unix - IOBase cleanup errors during test teardown due to changed error message format
- Pre-commit failures from flake8-annotations incompatibility
β What is the new behavior (if this is a feature change)?
All tests pass on Python 3.14 (Linux and Windows) with full backward compatibility for Python 3.8-3.13.
π Other information:
Root Cause: Python 3.14 changed the default multiprocessing start method from fork to forkserver on Unix platforms, breaking pytest-xdist parallel test execution.
Solution Applied:
-
Multiprocessing Fix (
cheroot/test/conftest.py):- Force
forkmethod on Python 3.14+ Unix systems only - Skip on Windows (doesn't support fork)
- Clean exception handling with
contextlib.suppress
- Force
-
IOBase Warning Filter (
pytest.ini):- Updated regex pattern to match Python 3.14's new error format
- Changed from
"Exception ignored in."to"Exception ignored.*"
-
Pre-commit Config (
.pre-commit-config.yaml):- Set flake8
language_version: python3.11to match CI - Prevents flake8-annotations Python 3.14 incompatibility
- Set flake8
Testing: Verified on Python 3.14.0rc3 with pytest-xdist parallel execution (n=auto).
π Contribution checklist:
- [x] I wrote descriptive pull request text above
- [x] I think the code is well written
- [x] I wrote good commit messages
- [ ] I have squashed related commits together after the changes have been approved
- [x] Unit tests for the changes exist
- [x] Integration tests for the changes exist (if applicable)
- [x] I used the same coding conventions as the rest of the project
- [x] The new code doesn't generate linter offenses
- [x] Documentation reflects the changes
- [x] The PR relates to only one subject with a clear title and description in grammatically correct, complete sentences