summaryrefslogtreecommitdiffstats
path: root/Lib/test/_test_multiprocessing.py
Commit message (Collapse)AuthorAgeFilesLines
* [3.12] gh-108416: Mark slow test methods with @requires_resource('cpu') ↵Miss Islington (bot)2023-09-021-0/+2
| | | | | | | | | | | | (GH-108421) (#108798) gh-108416: Mark slow test methods with @requires_resource('cpu') (GH-108421) Only mark tests which spend significant system or user time, by itself or in subprocesses. (cherry picked from commit f3ba0a74cd50274acdcd592d4ce8395b92492b7c) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* [3.12] gh-108520: Fix bad fork detection in nested multiprocessing use case ↵Miss Islington (bot)2023-08-301-0/+26
| | | | | | | | | | | | | | | (GH-108568) (#108691) gh-108520: Fix bad fork detection in nested multiprocessing use case (GH-108568) gh-107275 introduced a regression where a SemLock would fail being passed along nested child processes, as the `is_fork_ctx` attribute would be left missing after the first deserialization. --------- (cherry picked from commit add8d45cbe46581b9748909fbbf60fdc8ee8f71e) Co-authored-by: albanD <desmaison.alban@gmail.com> Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com> Co-authored-by: Antoine Pitrou <pitrou@free.fr>
* [3.12] gh-108388: Split test_multiprocessing_spawn (GH-108396) (#108442)Miss Islington (bot)2023-08-251-1/+9
| | | | | | | | | | | gh-108388: Split test_multiprocessing_spawn (GH-108396) Split test_multiprocessing_fork, test_multiprocessing_forkserver and test_multiprocessing_spawn into test packages. Each package is made of 4 sub-tests: processes, threads, manager and misc. It allows running more tests in parallel and so reduce the total test duration. (cherry picked from commit aa9a359ca2663195b0f04eef46109c28c4ff74d3) Co-authored-by: Victor Stinner <vstinner@python.org>
* [3.12] gh-77377: Ensure multiprocessing SemLock is valid for spawn-based ↵Miss Islington (bot)2023-08-231-0/+22
| | | | | | | | | | | | | | | | | Process before serializing it (GH-107275) (#108377) gh-77377: Ensure multiprocessing SemLock is valid for spawn-based Process before serializing it (GH-107275) Ensure multiprocessing SemLock is valid for spawn Process before serializing it. Creating a multiprocessing SemLock with a fork context, and then trying to pass it to a spawn-created Process, would segfault if not detected early. --------- (cherry picked from commit 1700d34d314f5304a7a75363bda295a8c15c371f) Co-authored-by: albanD <desmaison.alban@gmail.com> Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com> Co-authored-by: Antoine Pitrou <pitrou@free.fr>
* [3.12] gh-107963: Fix set_forkserver_preload to check the type of given list ↵Miss Islington (bot)2023-08-151-0/+8
| | | | | | | | | | | (GH-107965) (#107975) gh-107963: Fix set_forkserver_preload to check the type of given list (GH-107965) (cherry picked from commit 6515ec3d3d5acd3d0b99c88794bdec09f0831e5b) gh-107963: Fix set_forkserver_preload to check the type of given list Co-authored-by: Dong-hee Na <donghee.na@python.org>
* [3.12] gh-90876: Restore the ability to import multiprocessing when ↵Miss Islington (bot)2023-07-061-6/+76
| | | | | | | | | | | | | | `sys.executable` is `None` (GH-106464) (#106494) gh-90876: Restore the ability to import multiprocessing when `sys.executable` is `None` (GH-106464) Prevent `multiprocessing.spawn` from failing to *import* in environments where `sys.executable` is `None`. This regressed in 3.11 with the addition of support for path-like objects in multiprocessing. Adds a test decorator to have tests only run when part of test_multiprocessing_spawn to `_test_multiprocessing.py` so we can start to avoid re-running the same not-global-state specific test in all 3 modes when there is no need. (cherry picked from commit c60df361ce2d734148d503f4a711e67c110fe223) Co-authored-by: Gregory P. Smith <greg@krypto.org>
* gh-61460: Stronger HMAC in multiprocessing (#20380)Christian Heimes2023-05-201-10/+47
| | | | | | | | | | | | | | | | | | | | | | bpo-17258: `multiprocessing` now supports stronger HMAC algorithms for inter-process connection authentication rather than only HMAC-MD5. Signed-off-by: Christian Heimes <christian@python.org> gpshead: I Reworked to be more robust while keeping the idea. The protocol modification idea remains, but we now take advantage of the message length as an indicator of legacy vs modern protocol version. No more regular expression usage. We now default to HMAC-SHA256, but do so in a way that will be compatible when communicating with older clients or older servers. No protocol transition period is needed. More integration tests to verify these claims remain true are required. I'm unaware of anyone depending on multiprocessing connections between different Python versions. --------- Signed-off-by: Christian Heimes <christian@python.org> Co-authored-by: Gregory P. Smith [Google] <greg@krypto.org>
* gh-84559: Remove the new multiprocessing warning, too disruptive. (#101551)Gregory P. Smith2023-02-031-3/+2
| | | | This reverts the core of #100618 while leaving relevant documentation improvements and minor refactorings in place.
* GH-84559: Deprecate fork being the multiprocessing default. (#100618)Gregory P. Smith2023-02-021-8/+13
| | | | | | | | This starts the process. Users who don't specify their own start method and use the default on platforms where it is 'fork' will see a DeprecationWarning upon multiprocessing.Pool() construction or upon multiprocessing.Process.start() or concurrent.futures.ProcessPool use. See the related issue and documentation within this change for details.
* gh-60203: Always pass True/False as boolean arguments in tests (GH-99983)Serhiy Storchaka2022-12-041-1/+1
| | | Unless we explicitly test non-bool values.
* gh-92886: Fix tests that fail when running with optimizations (`-O`) in ↵Jack Hindmarch2022-10-191-23/+28
| | | | `_test_multiprocessing.py` (GH-93233)
* gh-96819: multiprocessing.resource_tracker: check if length of pipe write <= ↵Koki Saito2022-10-031-0/+8
| | | | | 512 (#96890) Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
* gh-97706: multiprocessing tests: Delete unused variable `rand` (#97707)Koki Saito2022-10-031-2/+1
|
* gh-95212: make multiprocessing test case parallel-safe (GH-95213)Christian Heimes2022-07-251-1/+1
|
* GH-94736: mark SemLock test as linux only (GH-94750)Kumar Aditya2022-07-111-0/+1
| | | | | | See https://buildbot.python.org/all/#/builders/172/builds/2522 The PR skips the test on non-linux platforms. Automerge-Triggered-By: GH:pablogsal
* GH-94736: Fix _multiprocessing.SemLock subclassing (#94738)Kumar Aditya2022-07-111-0/+11
| | | | | | | | | * fix allocator and deallocator * 📜🤖 Added by blurb_it. * code review Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
* GH-83658: make multiprocessing.Pool raise an exception if maxtasksperchild ↵Irit Katriel2022-06-171-0/+5
| | | | | is not None or a positive int (GH-93364) Closes #83658.
* Tests call sleeping_retry() with SHORT_TIMEOUT (#93870)Victor Stinner2022-06-151-2/+6
| | | | | | | Tests now call busy_retry() and sleeping_retry() with SHORT_TIMEOUT or LONG_TIMEOUT (of test.support), rather than hardcoded constants. Add also WAIT_ACTIVE_CHILDREN_TIMEOUT constant to _test_multiprocessing.
* Add test.support.busy_retry() (#93770)Victor Stinner2022-06-151-35/+25
| | | Add busy_retry() and sleeping_retry() functions to test.support.
* gh-90549: Fix leak of global named resources using multiprocessing spawn ↵Leo Trol2022-06-091-0/+30
| | | | | | (#30617) Co-authored-by: XD Trol <milestonejxd@gmail.com> Co-authored-by: Antoine Pitrou <pitrou@free.fr>
* bpo-46720: Add support for path-like objects to ↵Géry Ogam2022-04-221-0/+17
| | | | | multiprocessing.set_executable for Windows (GH-31279) This bring the API to be on a par with Unix-like systems.
* gh-91231: Add shutdown_timeout to multiprocessing BaseManager (#32112)Victor Stinner2022-04-191-13/+21
| | | | | | | | Add an optional keyword 'shutdown_timeout' parameter to the multiprocessing.BaseManager constructor. Kill the process if terminate() takes longer than the timeout. Multiprocessing tests pass test.support.SHORT_TIMEOUT to BaseManager.shutdown_timeout.
* bpo-46633: Skip tests on ASAN and/or MSAN builds (GH-31632)Victor Stinner2022-03-011-0/+6
| | | | | | | | | | | | Skip tests on ASAN and/or MSAN builds: * multiprocessing tests * test___all__ * test_concurrent_futures * test_decimal * test_peg_generator * test_tools The ASAN job of GitHub Actions no longer excludes these tests.
* bpo-45735: Promise the long-time truth that `args=list` works (GH-30982)Charlie Zhao2022-02-261-0/+24
| | | | | | For threads, and for multiprocessing, it's always been the case that ``args=list`` works fine when passed to ``Process()`` or ``Thread()``, and such code is common in the wild. But, according to the docs, only a tuple can be used. This brings the docs into synch with reality. Doc changes by Charlie Zhao. Co-authored-by: Tim Peters <tim.peters@gmail.com>
* bpo-25066: Added repr for multiprocessing.Event (GH-29749)Kumar Aditya2021-12-091-1/+14
| | | Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
* bpo-45125: Improves pickling docs and tests for `shared_memory` (GH-28294)Nikita Sobolev2021-10-011-31/+104
|
* bpo-45310: Fix parrallel shared memory tests (GH-28661)Serhiy Storchaka2021-10-011-16/+24
| | | | | | Add a PID to names of POSIX shared memory objects to allow running multiprocessing tests (test_multiprocessing_fork, test_multiprocessing_spawn, etc) in parallel.
* bpo-45209: fix `UserWarning: resource_tracker` in test_multiprocessing ↵Nikita Sobolev2021-09-211-0/+7
| | | | (GH-28377)
* bpo-45052: Unskips a failing `test_shared_memory_basics` test (GH-28182)Nikita Sobolev2021-09-061-2/+0
|
* bpo-45042: Now test classes decorated with `requires_hashdigest` are not ↵Nikita Sobolev2021-09-041-0/+1
| | | | | | skipped (GH-28060) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* bpo-25130: Add calls of gc.collect() in tests to support PyPy (GH-28005)Serhiy Storchaka2021-08-291-0/+5
|
* bpo-30256: Add manager_owned keyword arg to AutoProxy (GH-16341)finefoot2021-07-021-0/+10
| | | | Co-authored-by: Jordan Speicher <jordan@jspeicher.com>
* bpo-43651: PEP 597: Fix EncodingWarning in some tests (GH-25145)Inada Naoki2021-04-041-5/+5
| | | | | | | | | | | | | | | | | | | * test_asyncio * test_bz2 * test_math * test_cmath * test_cmd_line * test_cmd_line_script * test_compile * test_contextlib * test_profile * ctypes/test/test_find * test_multiprocessing * test_configparser * test_csv * test_dbm_dumb * test_decimal * test_difflib * os.fdopen() calls io.text_encoding() to emit EncodingWarning for right place.
* bpo-41344: Raise ValueError when creating shared memory of size 0 (GH-21556)Vinay Sharma2020-08-301-0/+12
|
* bpo-41521: Rename blacklist parameter to not_exported (GH-21824)Victor Stinner2020-08-171-2/+4
| | | | Rename "blacklist" parameter of test.support.check__all__() to "not_exported".
* bpo-40275: Use new test.support helper submodules in tests (GH-21764)Hai Shi2020-08-071-15/+17
|
* bpo-38169: Increase code coverage for SharedMemory and ShareableList (GH-16139)Vinay Sharma2020-07-191-0/+29
|
* bpo-40275: Use new test.support helper submodules in tests (GH-21169)Hai Shi2020-06-301-1/+2
|
* bpo-41043: Escape literal part of the path for glob(). (GH-20994)Serhiy Storchaka2020-06-201-1/+1
|
* bpo-38377: Add support.skip_if_broken_multiprocessing_synchronize() (GH-20944)Victor Stinner2020-06-181-1/+1
| | | | | | On Linux, skip tests using multiprocessing if the current user cannot create a file in /dev/shm/ directory. Add the skip_if_broken_multiprocessing_synchronize() function to the test.support module.
* bpo-17258: Add requires_hashdigest to multiprocessing tests (GH-20412)Christian Heimes2020-06-041-0/+10
| | | | | Skip some :mod:`multiprocessing` tests when MD5 hash digest is blocked. Signed-off-by: Christian Heimes <christian@python.org>
* bpo-40275: Adding threading_helper submodule in test.support (GH-20263)Hai Shi2020-05-271-2/+3
|
* bpo-39244: multiprocessing return default start method first on macOS (GH-18625)idomic2020-05-261-1/+3
|
* bpo-40135: Fix multiprocessing test_shared_memory_across_processes() (GH-19892)Hai Shi2020-05-041-1/+3
| | | | Don't define shared memory block's name in test_shared_memory_across_processes(): use SharedMemory(create=True) instead.
* bpo-30966: Add multiprocessing.SimpleQueue.close() (GH-19735)Victor Stinner2020-04-271-0/+14
| | | | | | Add a new close() method to multiprocessing.SimpleQueue to explicitly close the queue. Automerge-Triggered-By: @pitrou
* bpo-40275: Avoid importing socket in test.support (GH-19603)Serhiy Storchaka2020-04-251-4/+5
| | | | | | * Move socket related functions from test.support to socket_helper. * Import socket, nntplib and urllib.error lazily in transient_internet(). * Remove importing multiprocess.
* bpo-39983: Add test.support.print_warning() (GH-19683)Victor Stinner2020-04-231-19/+13
| | | | | | | Log "Warning -- ..." test warnings into sys.__stderr__ rather than sys.stderr, to ensure to display them even if sys.stderr is captured. test.libregrtest.utils.print_warning() now calls test.support.print_warning().
* bpo-40330: Fix utf-8 size check in ShareableList (GH-19606)Antoine Pitrou2020-04-201-2/+14
| | | | | The item size must be checked after encoding to bytes, not before. Automerge-Triggered-By: @pitrou
* bpo-40094: Add test.support.wait_process() (GH-19254)Victor Stinner2020-03-311-1/+1
| | | | | | | | | Moreover, the following tests now check the child process exit code: * test_os.PtyTests * test_mailbox.test_lock_conflict() * test_tempfile.test_process_awareness() * test_uuid.testIssue8621() * multiprocessing resource tracker tests
* bpo-39360: Ensure all workers exit when finalizing a multiprocessing Pool ↵Batuhan Taşkaya2020-03-151-0/+18
| | | | | | | | | (GH-19009) When the pull is not used via the context manager or terminate() is called, there is a system in multiprocessing.util that handles finalization of all pools via an atexit handler (the Finalize) class. This class registers the _terminate_pool handler in the registry of finalizers of the module, and that registry is called on interpreter exit via _exit_function. The problem is that the "happy" path with the context manager or manual call to finalize() does some extra steps that _terminate_pool does not. The step that is not executed when the atexit() handler calls _terminate_pool is pinging the _change_notifier queue to unblock the maintenance threads. This commit moves the notification to the _terminate_pool function so is called from both code paths. Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>