summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_concurrent_futures
Commit message (Collapse)AuthorAgeFilesLines
* [3.12] Fix typos (#123775) (#123867)Victor Stinner2024-09-091-2/+2
| | | | | | | Fix typos (#123775) (cherry picked from commit 9017b95ff2dcff16bcb0b0a609ed2b0daa845943) Co-authored-by: algonell <algonell@gmail.com>
* [3.12] gh-112536: Add TSAN build on Github Actions (GH-116872)Antoine Pitrou2024-03-181-0/+4
| | | | | (cherry picked from commit 20578a1f68c841a264b72b00591b11ab2fa77b43) Co-authored-by: Donghee Na <donghee.na@python.org>
* [3.12] gh-116682: stdout may be empty in test_cancel_futures_wait_false ↵Miss Islington (bot)2024-03-131-1/+3
| | | | | | | | | (GH-116683) (#116692) If the `shutdown()` call happens before the worker thread starts executing the task, then nothing will be printed to stdout. (cherry picked from commit 7d1abe9502641a3602e9773aebc29ee56d8f40ae) Co-authored-by: Sam Gross <colesbury@gmail.com>
* [3.12] gh-109917: Fix test instability in test_concurrent_futures ↵Miss Islington (bot)2023-10-031-1/+2
| | | | | | | | | | | | | | | | | (GH-110306) (#110315) gh-109917: Fix test instability in test_concurrent_futures (GH-110306) The test had an instability issue due to the ordering of the dummy queue operation and the real wakeup pipe operations. Both primitives are thread safe but not done atomically as a single update and may interleave arbitrarily. With the old order of operations this can lead to an incorrect state where the dummy queue is full but the wakeup pipe is empty. By swapping the order in clear() I think this can no longer happen in any possible operation interleaving (famous last words). (cherry picked from commit a376a72bd92cd7c9930467dd1aba40045fb75e3b) Co-authored-by: elfstrom <elfstrom@users.noreply.github.com>
* [3.12] gh-109047: concurrent.futures catches RuntimeError (#109810) (#110126)Victor Stinner2023-10-021-0/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | gh-109047: concurrent.futures catches PythonFinalizationError (#109810) concurrent.futures: The *executor manager thread* now catches exceptions when adding an item to the *call queue*. During Python finalization, creating a new thread can now raise RuntimeError. Catch the exception and call terminate_broken() in this case. Add test_python_finalization_error() to test_concurrent_futures. concurrent.futures._ExecutorManagerThread changes: * terminate_broken() no longer calls shutdown_workers() since the call queue is no longer working anymore (read and write ends of the queue pipe are closed). * terminate_broken() now terminates child processes, not only wait until they complete. * _ExecutorManagerThread.terminate_broken() now holds shutdown_lock to prevent race conditons with ProcessPoolExecutor.submit(). multiprocessing.Queue changes: * Add _terminate_broken() method. * _start_thread() sets _thread to None on exception to prevent leaking "dangling threads" even if the thread was not started yet. (cherry picked from commit 635184212179b0511768ea1cd57256e134ba2d75)
* [3.12] gh-109594: Fix concurrent.futures test_timeout() (GH-110018) (#110021)Miss Islington (bot)2023-10-021-8/+9
| | | | | | | | | | | | | gh-109594: Fix concurrent.futures test_timeout() (GH-110018) Fix test_timeout() of test_concurrent_futures.test_wait. Remove the future which may or may not complete depending if it takes longer than the timeout ot not. Keep the second future which does not complete before wait(). Make also the test faster: 0.5 second instead of 6 seconds, so remove @support.requires_resource('walltime') decorator. (cherry picked from commit 9be283e5e15d5d5685b78a38eb132501f7f3febb) Co-authored-by: Victor Stinner <vstinner@python.org>
* [3.12] gh-109565: Fix concurrent.futures test_future_times_out() (GH-109949) ↵Miss Islington (bot)2023-10-021-2/+5
| | | | | | | | | | | (#109952) gh-109565: Fix concurrent.futures test_future_times_out() (GH-109949) as_completed() uses a timeout of 100 ms instead of 10 ms. Windows monotonic clock resolution is around 15.6 ms. (cherry picked from commit b1aebf1e6576680d606068d17e2208259573e061) Co-authored-by: Victor Stinner <vstinner@python.org>
* [3.12] gh-109832: concurrent.futures test_deadlock restores sys.stderr ↵Miss Islington (bot)2023-10-021-0/+6
| | | | | | | | | | | | (GH-109887) (#109892) gh-109832: concurrent.futures test_deadlock restores sys.stderr (GH-109887) test_error_at_task_unpickle() and test_error_during_result_unpickle_in_result_handler() now restore sys.stderr which is overriden by _raise_error_ignore_stderr(). (cherry picked from commit 2897142d2ec0930a8991af964c798b68fb6dcadd) Co-authored-by: Victor Stinner <vstinner@python.org>
* [3.12] gh-109702: Increase concurrent_futures deadlock timeout (GH-109703) ↵Miss Islington (bot)2023-10-021-1/+1
| | | | | | | | | | | (#109705) gh-109702: Increase concurrent_futures deadlock timeout (GH-109703) Replace SHORT_TIMEOUT with LONG_TIMEOUT in test_deadlock of test_concurrent_futures. (cherry picked from commit 1eb1b45183c3b8aeefe3d5d27694155741e82bbc) Co-authored-by: Victor Stinner <vstinner@python.org>
* [3.12] gh-105829: Fix concurrent.futures.ProcessPoolExecutor deadlock ↵elfstrom2023-10-021-1/+71
| | | | | | (GH-108513) (#109784) This fixes issue GH-105829, https://github.com/python/cpython/issues/105829 (cherry picked from commit 405b06375a8a4cdb08ff53afade09a8b66ec23d5)
* [3.12] gh-108834: Sync libregrtest with the main branch (#108966)Victor Stinner2023-09-082-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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-108388: Convert test_concurrent_futures to package (#108401) (#108443)Victor Stinner2023-08-2611-0/+1844
gh-108388: Convert test_concurrent_futures to package (#108401) Convert test_concurrent_futures to a package of sub-tests. (cherry picked from commit aa6f787faa4bc45006da4dc2f942fb9b82c98836)