Skip to content

Use a private fork context for the live server on POSIX - #207

Open
vitlav wants to merge 1 commit into
pytest-dev:masterfrom
vitlav:fix-posix-live-server-context
Open

vitlav wants to merge 1 commit into
pytest-dev:masterfrom
vitlav:fix-posix-live-server-context

Conversation

@vitlav

@vitlav vitlav commented Oct 21, 2026

Copy link
Copy Markdown

Python 3.14 defaults to forkserver on Linux, so starting the live server fails when multiprocessing tries to pickle the nested worker function. Use the existing private fork context wherever that start method is available, preserving the application's global multiprocessing setting.

The regression test runs in a separate pytest process, selects both forkserver and spawn, and checks a real HTTP response from a local Flask route. Both cases fail with PicklingError before the change and pass afterwards. This extends the macOS repair in #161; it retains the existing fork-based server model.

Fixes #206

Validation on Python 3.14.7, Flask 3.1.3 and pytest 9.0.3: pytest -q — 35 passed, 1 existing skip; configured pre-commit hooks pass for all changed files. The existing skip and pytest configuration/deprecation warnings are unchanged.

Checklist:

  • Add tests that demonstrate the correct behavior of the change. Tests should fail without the change.
  • Add or update relevant docs, in the docs folder and in code.
  • Add an entry in docs/CHANGELOG.rst, summarizing the change and linking to the issue. (Entry added to docs/changelog.rst.)
  • Run pre-commit hooks and fix any issues.
  • Run pytest and make sure no tests failed.

This branch has not been deployed

No deployments
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.

live_server fails with Python 3.14's forkserver default on Linux

1 participant