Skip to content

Forkserver-based tests error instead of skipping when the forkserver start method is unavailable #154272

Description

@serhiy-storchaka

Bug report

Bug description

On platforms where the forkserver start method isn't available ('forkserver' not in multiprocessing.get_all_start_methods() — e.g. any build without HAVE_SEND_HANDLE), some forkserver tests error instead of skipping:

  • test_concurrent_futures ProcessPoolForkserver* classes — ProcessPoolForkserverMixin.get_context() calls multiprocessing.get_context('forkserver'), which raises ValueError: cannot find context for 'forkserver'.
  • test_concurrent_futures.test_init.FailingInitializerResourcesTest.test_forkserver — runs the (skipped) inner test, then asserts _resource_tracker._exitcode == 0, getting None.
  • test_multiprocessing_forkserver.test_preloadsetUp calls get_context('forkserver') directly, bypassing the setUpModule guard that the other forkserver test modules have.

(The test_processes/test_manager/test_threads modules already skip cleanly via _test_multiprocessing.setUpModule, which catches the set_start_method ValueError.)

Fix

Skip these when forkserver isn't available: guard the whole test_multiprocessing_forkserver package in its __init__.py (covers test_preload), and add "forkserver" not in multiprocessing.get_all_start_methods() skips to ProcessPoolForkserverMixin.get_context() and test_init's test_forkserver.

Related: gh-154271 (defining _XOPEN_SOURCE=600 makes forkserver available on Solaris/illumos; this issue is the independent test-robustness fix for platforms that genuinely lack it).

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    3.13bugs and security fixes3.14bugs and security fixes3.15pre-release feature fixes, bugs and security fixes3.16new features, bugs and security fixestestsTests in the Lib/test dirtopic-multiprocessingtype-bugAn unexpected behavior, bug, or error

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions