summaryrefslogtreecommitdiffstats
path: root/Lib/test/_test_multiprocessing.py
Commit message (Collapse)AuthorAgeFilesLines
* [3.12] gh-113205: test_multiprocessing.test_terminate: Give tasks a chance ↵Miss Islington (bot)2024-01-241-0/+1
| | | | | | | to start (GH-114249) (GH-114516) (cherry picked from commit ce75b4c26d18dcd840fd2e7ee362a84209648d06) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* [3.12] gh-113205: test_multiprocessing.test_terminate: Shorter sleep for ↵Miss Islington (bot)2024-01-181-1/+9
| | | | | | | | | | | | | | threadpools (GH-114186) (GH-114222) Threads can't be forced to terminate (without potentially corrupting too much state), so the expected behaviour of `ThreadPool.terminate` is to wait for the currently executing tasks to finish. Use shorter sleep time for threadpools, so if a task manages to start, the test doesn't block for long. (cherry picked from commit c1db9606081bdbe0207f83a861a3c70c356d3704) Co-authored-by: Petr Viktorin <encukou@gmail.com>
* [3.12] gh-113421: Fix multiprocessing logger for "%(filename)s" (GH-113423) ↵Miss Islington (bot)2023-12-241-0/+23
| | | | | | | (GH-113450) (cherry picked from commit ce77ee50358c0668eda5078f50b38f0770a370ab) Co-authored-by: Xu Song <xusong.vip@gmail.com>
* [3.12] gh-111284: Make multiprocessing tests with threads faster and more ↵Miss Islington (bot)2023-10-301-9/+21
| | | | | | | reliable (GH-111285) (GH-111510) (cherry picked from commit 624ace5a2f02715d084c29eaf2211cd0dd550690) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* [3.12] gh-110662: multiprocessing test_async_timeout() increase timeout ↵Miss Islington (bot)2023-10-111-1/+1
| | | | | | | | | | | (GH-110663) (#110674) gh-110662: multiprocessing test_async_timeout() increase timeout (GH-110663) Increase timeout from 1 second to 30 seconds, if not longer. The important part is that apply_async() takes longer than TIMEOUT2. (cherry picked from commit 790ecf6302e47b84da5d1c3b14dbdf070bce615b) Co-authored-by: Victor Stinner <vstinner@python.org>
* [3.12] gh-110666: Fix multiprocessing test_terminate() elapsed (GH-110667) ↵Miss Islington (bot)2023-10-111-20/+15
| | | | | | | | | | | | | (#110668) gh-110666: Fix multiprocessing test_terminate() elapsed (GH-110667) multiprocessing test_terminate() and test_wait_socket_slow() no longer test the CI performance: no longer check maximum elapsed time. Add CLOCK_RES constant: tolerate a difference of 100 ms. (cherry picked from commit 1556f426da3f2fb5842689999933c8038b65c034) Co-authored-by: Victor Stinner <vstinner@python.org>
* [3.12] gh-110656: Fix logging test_post_fork_child_no_deadlock() if ASAN ↵Miss Islington (bot)2023-10-111-2/+2
| | | | | | | | | | | | (GH-110657) (#110664) gh-110656: Fix logging test_post_fork_child_no_deadlock() if ASAN (GH-110657) Skip test_post_fork_child_no_deadlock() if Python is built with ASAN. Add support.HAVE_ASAN_FORK_BUG. (cherry picked from commit f901f56313610389027cb4eae80d1d4b071aef69) Co-authored-by: Victor Stinner <vstinner@python.org>
* [3.12] gh-109840: Fix multiprocessing test_waitfor_timeout() (GH-110428) ↵Miss Islington (bot)2023-10-051-3/+3
| | | | | | | | | | | (#110430) gh-109840: Fix multiprocessing test_waitfor_timeout() (GH-110428) Don't measure the CI performance: don't fail if cond.wait_for() takes longer than 1 second on a slow CI. (cherry picked from commit 5eae8dc2cb832af6ae1ee340fb0194107fe3bd6e) Co-authored-by: Victor Stinner <vstinner@python.org>
* [3.12] gh-110036: multiprocessing Popen.terminate() catches PermissionError ↵Miss Islington (bot)2023-10-021-2/+3
| | | | | | | | | | | | | (GH-110037) (#110064) gh-110036: multiprocessing Popen.terminate() catches PermissionError (GH-110037) On Windows, multiprocessing Popen.terminate() now catchs PermissionError and get the process exit code. If the process is still running, raise again the PermissionError. Otherwise, the process terminated as expected: store its exit code. (cherry picked from commit bd4518c60c9df356cf5e05b81305e3644ebb5e70) Co-authored-by: Victor Stinner <vstinner@python.org>
* [3.12] gh-89363: Skip threading test_is_alive_after_fork() if ASAN ↵Miss Islington (bot)2023-10-021-1/+1
| | | | | | | | | | | (GH-109835) (#109855) gh-89363: Skip threading test_is_alive_after_fork() if ASAN (GH-109835) Skip test_is_alive_after_fork() of test_threading if Python is built with Address Sanitizer (ASAN). (cherry picked from commit bc06743533b5fea2d5ecdad6dd3caa372c67439f) Co-authored-by: Victor Stinner <vstinner@python.org>
* [3.12] gh-109706: Fix multiprocessing test_nested_startmethod() (GH-109707) ↵Miss Islington (bot)2023-10-021-1/+3
| | | | | | | | | | (#109762) gh-109706: Fix multiprocessing test_nested_startmethod() (GH-109707) Don't check order, queue items can be written in any order. (cherry picked from commit b03a791497ff4b3c42805e06c73d08ac34087402) Co-authored-by: Victor Stinner <vstinner@python.org>
* [3.12] gh-108834: Sync libregrtest with the main branch (#108966)Victor Stinner2023-09-081-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * gh-108834: regrtest reruns failed tests in subprocesses (#108839) When using --rerun option, regrtest now re-runs failed tests in verbose mode in fresh worker processes to have more deterministic behavior. So it can write its final report even if a test killed a worker progress. Add --fail-rerun option to regrtest: exit with non-zero exit code if a test failed pass passed when re-run in verbose mode (in a fresh process). That's now more useful since tests can pass when re-run in a fresh worker progress, whereas they failed when run after other tests when tests are run sequentially. Rename --verbose2 option (-w) to --rerun. Keep --verbose2 as a deprecated alias. Changes: * Fix and enhance statistics in regrtest summary. Add "(filtered)" when --match and/or --ignore options are used. * Add RunTests class. * Add TestResult.get_rerun_match_tests() method * Rewrite code to serialize/deserialize worker arguments as JSON using a new WorkerJob class. * Fix stats when a test is run with --forever --rerun. * If failed test names cannot be parsed, log a warning and don't filter tests. * test_regrtest.test_rerun_success() now uses a marker file, since the test is re-run in a separated process. * Add tests on normalize_test_name() function. * Add test_success() and test_skip() tests to test_regrtest. (cherry picked from commit 31c2945f143c6b80c837fcf09a5cfb85fea9ea4c) * gh-108834: regrtest --fail-rerun exits with code 5 (#108896) When the --fail-rerun option is used and a test fails and then pass, regrtest now uses exit code 5 ("rerun) instead of 2 ("bad test"). (cherry picked from commit 1170d5a292b46f754cd29c245a040f1602f70301) * gh-108416: Mark slow but not CPU bound test methods with requires_resource('walltime') (GH-108480) (cherry picked from commit 1e0d62793a84001e92f1c80b511d3a212b435acc) * Manually sync Lib/test/libregrtest/ from main --------- Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* [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
|