summaryrefslogtreecommitdiffstats
path: root/Lib/test/support
Commit message (Collapse)AuthorAgeFilesLines
* gh-103109: Document ignore_warnings() test support helper (GH-103110)Miss Islington (bot)2023-04-021-1/+1
| | | | | | (cherry picked from commit 32937d6aa414ec7db5c63ef277f21db1880b3af4) Co-authored-by: Charlie Zhao <zhaoyu_hit@qq.com> Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM>
* Fix broken link to MSDN (GH-102355)Miss Islington (bot)2023-03-131-1/+1
| | | | | (cherry picked from commit 9a8b66b58c74236959a01d579e2c156d9c2e7cb3) Co-authored-by: 谭九鼎 <109224573@qq.com>
* [3.11] gh-90867: test.support.wait_process() uses LONG_TIMEOUT (#99071) (#99098)Victor Stinner2022-11-041-3/+3
| | | | | | | | | The test.support.wait_process() function now uses a timeout of LONG_TIMEOUT seconds by default, instead of SHORT_TIMEOUT. It doesn't matter if a Python buildbot is slower, it only matters that the process completes. The timeout should just be shorter than "forever". (cherry picked from commit f09da28768b77713566e932e912f107b6b57e8fd)
* [3.11] gh-98741: Remove useless check_home usage from is_python_build usage ↵Miss Islington (bot)2022-10-261-1/+1
| | | | | (GH-98743) (GH-98746) Co-authored-by: Henry Schreiner <HenrySchreinerIII@gmail.com>
* [3.11] gh-95778: CVE-2020-10735: Prevent DoS by very large int() (#96500)Gregory P. Smith2022-09-021-0/+11
| | | | | | | | | | | | | | | | | | Integer to and from text conversions via CPython's bignum `int` type is not safe against denial of service attacks due to malicious input. Very large input strings with hundred thousands of digits can consume several CPU seconds. This PR comes fresh from a pile of work done in our private PSRT security response team repo. This backports https://github.com/python/cpython/pull/96499 aka 511ca9452033ef95bc7d7fc404b8161068226002 Signed-off-by: Christian Heimes [Red Hat] <christian@python.org> Tons-of-polishing-up-by: Gregory P. Smith [Google] <greg@krypto.org> Reviews via the private PSRT repo via many others (see the NEWS entry in the PR). <!-- gh-issue-number: gh-95778 --> * Issue: gh-95778 <!-- /gh-issue-number --> I wrote up [a one pager for the release managers](https://docs.google.com/document/d/1KjuF_aXlzPUxTK4BMgezGJ2Pn7uevfX7g0_mvgHlL7Y/edit#).
* gh-90473: Fix more tests on platforms without umask (GH-95164)Miss Islington (bot)2022-07-231-0/+5
| | | | | (cherry picked from commit 68393248947adaa61962cd44e9d49c44017ba94f) Co-authored-by: Christian Heimes <christian@python.org>
* gh-94315: Check for DAC override capability (GH-94316)Miss Islington (bot)2022-06-271-1/+43
| | | | | | | | ``os.geteuid() == 0`` is not a reliable check whether the current user has the capability to bypass permission checks. Tests now probe for DAC override. (cherry picked from commit 7e0d98ecb3f049841de9854e7a3eca3e2638e4b2) Co-authored-by: Christian Heimes <christian@python.org>
* gh-93951: In test_bdb.StateTestCase.test_skip, avoid including auxiliary ↵Miss Islington (bot)2022-06-221-0/+10
| | | | | | | | importers. (GH-93962) (GH-94118) Co-authored-by: Brett Cannon <brett@python.org> (cherry picked from commit c029b552f39200977325d4351803bdd13ddccc4f) Co-authored-by: Jason R. Coombs <jaraco@jaraco.com>
* gh-91321: Fix compatibility with C++ older than C++11 (#93784) (#93802)Victor Stinner2022-06-141-0/+17
| | | | | | | | | | | * Fix the compatibility of the Python C API with C++ older than C++11. * _Py_NULL is only defined as nullptr on C++11 and newer. (cherry picked from commit 4caf5c2753f1aa28d6f4bc1aa377975fd2a62331) * test_cppext now builds the C++ extension with setuptools. * Add @test.support.requires_venv_with_pip. (cherry picked from commit ca0cc9c433830e14714a5cc93fb4e7254da3dd76)
* gh-90473: Make chmod a dummy on WASI, skip chmod tests (GH-93534) (GH-93550)Miss Islington (bot)2022-06-061-0/+36
| | | | | | WASI does not have the ``chmod(2)`` syscall yet. (cherry picked from commit 22fed605e096eb74f3aa33f6d25aee76fdc2a3fa) Co-authored-by: Christian Heimes <christian@python.org>
* gh-90473: WASI requires proper open(2) flags (GH-93529)Miss Islington (bot)2022-06-061-1/+4
| | | | | (cherry picked from commit 4c71d22c4f9fdde6f2234e7dc6a862419cd6fd98) Co-authored-by: Christian Heimes <christian@python.org>
* gh-90473: wasmtime does not support absolute symlinks (GH-93490)Miss Islington (bot)2022-06-051-2/+6
| | | | | (cherry picked from commit 6f8367d3489eff07139bc908fdf666fc904ca445) Co-authored-by: Christian Heimes <christian@python.org>
* gh-84461: Skip dtrace/network tests that are enabled by -u all (GH-93473)Miss Islington (bot)2022-06-031-0/+2
| | | | | (cherry picked from commit 1a8a0ddb1c62ef9aff598e7e3e3a65cf35353932) Co-authored-by: Christian Heimes <christian@python.org>
* gh-90473: WASI: skip gethostname tests (GH-93092)Miss Islington (bot)2022-05-231-0/+3
| | | | | | | | | - WASI's ``gethostname()`` is a stub that always fails with OSError ``ENOTSUP`` - skip mailcap ``test`` if subprocess is not available - WASI process_time clock does not work. (cherry picked from commit 760ec8940aabd6a7fc471bd913ea1ac501cc604b) Co-authored-by: Christian Heimes <christian@python.org>
* gh-90473: Decrease recursion limit and skip tests on WASI (GH-92803)Miss Islington (bot)2022-05-191-0/+5
| | | | | (cherry picked from commit 137fd3d88aa46669f5717734e823f4c594ab2843) Co-authored-by: Christian Heimes <christian@python.org>
* [3.11] gh-90473: Skip tests that don't apply to Emscripten and WASI ↵Christian Heimes2022-05-161-1/+1
| | | | | (GH-92846) (GH-92851) Co-authored-by: Christian Heimes <christian@python.org>
* gh-90473: Increase stack size, disable obmalloc on WASI (GH-92732)Miss Islington (bot)2022-05-131-1/+1
| | | | | (cherry picked from commit d81d57e9598dea741e049f3876ccd87072a38906) Co-authored-by: Christian Heimes <christian@python.org>
* gh-84461: Add sys._emscripten_info, improve docs and build (gh-91781)Christian Heimes2022-04-231-6/+1
|
* gh-91156: Use `locale.getencoding()` instead of getpreferredencoding (GH-91732)Inada Naoki2022-04-221-1/+1
| | | Co-authored-by: Victor Stinner <vstinner@python.org>
* gh-91217: deprecate nntplib (GH-91543)Brett Cannon2022-04-151-2/+2
|
* bpo-40280: Detect missing threading on WASM platforms (GH-32352)Christian Heimes2022-04-071-1/+14
| | | Co-authored-by: Brett Cannon <brett@python.org>
* bpo-47061: deprecate the `aifc` module (GH-32134)Brett Cannon2022-04-051-0/+8
| | | Co-authored-by: Christian Heimes <christian@python.org>
* bpo-46126: Restore 'descriptions' when running tests internally. (GH-32128)Jason R. Coombs2022-04-031-5/+1
| | | | | This reverts commit a941e5927f7f2540946813606c61c6aea38db426 (GH-30194). Automerge-Triggered-By: GH:jaraco
* bpo-40280: Detect if WASM platform supports threading (GH-32243)Christian Heimes2022-04-021-0/+27
| | | Automerge-Triggered-By: GH:tiran
* Replace with_traceback() with exception chaining and reraising (GH-32074)Oleg Iarygin2022-03-301-1/+1
|
* bpo-40280: Skip socket, fork, subprocess tests on Emscripten (GH-31986)Christian Heimes2022-03-221-0/+16
| | | | | | | | | | | - Add requires_fork and requires_subprocess to more tests - Skip extension import tests if dlopen is not available - Don't assume that _testcapi is a shared extension - Skip a lot of socket tests that don't work on Emscripten - Skip mmap tests, mmap emulation is incomplete - venv does not work yet - Cannot get libc from executable The "entire" test suite is now passing on Emscripten with EMSDK from git head (91 suites are skipped).
* bpo-47037: Don't test for strftime('%4Y') on Windows (GH-31945)Christian Heimes2022-03-181-4/+7
|
* bpo-46587: Skip tests if strftime does not support glibc extension (GH-31873)Christian Heimes2022-03-151-20/+25
| | | Co-authored-by: Victor Stinner <vstinner@python.org>
* bpo-46198: rename duplicate tests and remove unused code (GH-30297)Nikita Sobolev2022-03-101-3/+3
|
* bpo-40280: Skip more tests/features that don't apply to Emscripten (GH-31791)Christian Heimes2022-03-101-1/+1
| | | | | | | - fd inheritance can't be modified because Emscripten doesn't support subprocesses anyway. - setpriority always fails - geteuid no longer causes problems with latest emsdk - umask is a stub - geteuid / getuid always return 0, but process cannot chown to random uid.
* bpo-40280: Block more non-working syscalls in Emscripten (GH-31757)Christian Heimes2022-03-081-2/+2
| | | | | | | | | - getgroups always fails. - geteuid and getegid always return 0 (root), which confuse tarfile and tests. - hardlinks (link, linkat) always fails. - non-encodable file names are not supported by NODERAWFS layer. - mark more tests with dependency on subprocess and multiprocessing. Mocking does not work if the module fails to import.
* bpo-46678: Fix Invalid cross device link in ↵Jason Wilkes2022-02-081-1/+2
| | | | | | | Lib/test/support/import_helper.py (GH-31204) In [Lib/test/support/import_helper.py](https://github.com/python/cpython/blob/master/Lib/test/support/import_helper.py), the function `make_legacy_pyc` makes a call to `os.rename` which can fail when the source and target live on different devices. This happens (for example) when `PYTHONPYCACHEPREFIX` is set to a directory anywhere on disk, while a ramdisk is mounted on `/tmp` (the latter of which is the default on various Linux distros). Replacing `os.rename` with `shutil.move` fixes this. Automerge-Triggered-By: GH:brettcannon
* bpo-46659: test.support avoids locale.getdefaultlocale() (GH-31167)Victor Stinner2022-02-061-1/+1
| | | | | skip_if_buggy_ucrt_strfptime() of test.support now uses locale.getpreferredencoding(False) instead of locale.getdefaultlocale() to get the Windows code page.
* bpo-40280: Address more test failures on Emscripten (GH-31050)Christian Heimes2022-02-052-1/+3
| | | Co-authored-by: Brett Cannon <brett@python.org>
* bpo-45629: Improve test.support.skip_if_buildbot (GH-31094)Gregory P. Smith2022-02-031-4/+6
| | | | | | | It was added as part of #29222 to avoid running freeze tool tests on the buildbots but the logic was wrong so it did not skip tests on typical posix setup buildbots where the worker is launched from cron via an @reboot task and thus have no USER environment variable. This uses the canonical `getpass.getuser()` API rather than rolling its own attempt.
* Add skips to crashing tests under sanitizers instead of manually skipping ↵Pablo Galindo Salgado2022-01-251-6/+11
| | | | them (GH-30897)
* Refactor sanitiser skip tests into test.support (GH-30889)Pablo Galindo Salgado2022-01-251-1/+30
| | | | | | | * Refactor sanitizer skip tests into test.support * fixup! Refactor sanitizer skip tests into test.support * fixup! fixup! Refactor sanitizer skip tests into test.support
* bpo-40280: Skip subprocess-based tests on wasm32-emscripten (GH-30615)Christian Heimes2022-01-252-4/+21
|
* bpo-46126: Disable 'descriptions' when running tests internally. (GH-30194)Jason R. Coombs2022-01-221-1/+5
|
* bpo-46426: Improve tests for the dir_fd argument (GH-30668)Serhiy Storchaka2022-01-211-0/+11
| | | | | | | Ensure that directory file descriptors refer to directories different from the current directory, and that src_dir_fd and dst_dir_fd refer to different directories. Add context manager open_dir_fd() in test.support.os_helper.
* bpo-40280: Add requires_fork test helper (GH-30622)Christian Heimes2022-01-161-2/+12
|
* Revert "bpo-28533: Remove asyncore, asynchat, smtpd modules (GH-29521)" ↵Victor Stinner2021-12-073-1704/+0
| | | | | (GH-29951) This reverts commit 9bf2cbc4c498812e14f20d86acb61c53928a5a57.
* bpo-45954: Rename PyConfig.no_debug_ranges to code_debug_ranges (GH-29886)Victor Stinner2021-12-021-1/+1
| | | | | | | Rename PyConfig.no_debug_ranges to PyConfig.code_debug_ranges and invert the value. Document -X no_debug_ranges and PYTHONNODEBUGRANGES env var in PyConfig.code_debug_ranges documentation.
* bpo-28533: Remove asyncore, asynchat, smtpd modules (GH-29521)Victor Stinner2021-11-153-0/+1704
| | | | | | | | | | | | | | | | Remove the asyncore and asynchat modules, deprecated in Python 3.6: use the asyncio module instead. Remove the smtpd module, deprecated in Python 3.6: the aiosmtpd module can be used instead, it is based on asyncio. * Remove asyncore, asynchat and smtpd documentation * Remove test_asyncore, test_asynchat and test_smtpd * Rename Lib/asynchat.py to Lib/test/support/_asynchat.py * Rename Lib/asyncore.py to Lib/test/support/_asyncore.py * Rename Lib/smtpd.py to Lib/test/support/_smtpd.py * Remove DeprecationWarning from private _asyncore, _asynchat and _smtpd modules * _smtpd: remove deprecated properties
* bpo-45668: Fix PGO tests without test extensions (GH-29315)Christian Heimes2021-11-011-2/+8
|
* bpo-45629: Add a test for the "freeze" tool. (gh-29222)Eric Snow2021-10-281-0/+11
| | | | | | | The "freeze" tool has been part of the repo for a long time. However, it hasn't had any tests in the test suite to guard against regressions. We add such a test here. This is especially important as there has been a lot of change recently related to frozen modules, with more to come. Note that as part of the test we build Python out-of-tree and install it in a temp dir. https://bugs.python.org/issue45629
* bpo-45410: regrtest -W leaves stdout/err FD unchanged (GH-28915)Victor Stinner2021-10-131-3/+5
| | | | | | | | | | | | support.print_warning() now stores the original value of sys.__stderr__ and uses it to log warnings. libregrtest uses the same stream to log unraisable exceptions and uncaught threading exceptions. Partially revert commit dbe213de7ef28712bbfdb9d94a33abb9c33ef0c2: libregrtest no longer replaces sys.__stdout__, sys.__stderr__, and stdout and stderr file descriptors. Remove also a few unused imports in libregrtest.
* bpo-45410: Enhance libregrtest -W/--verbose3 option (GH-28908)Victor Stinner2021-10-121-1/+3
| | | | | | | | | | | libregrtest -W/--verbose3 now also replace sys.__stdout__, sys.__stderr__, and stdout and stderr file descriptors (fd 1 and fd 2). support.print_warning() messages are now logged in the expected order. The "./python -m test test_eintr -W" command no longer logs into stdout if the test pass.
* bpo-45410: Add test.support.flush_std_streams() (GH-28885)Victor Stinner2021-10-111-0/+9
| | | support.print_warning() now flushs sys.stdout.
* Fix typos in the Lib directory (GH-28775)Christian Clauss2021-10-061-1/+1
| | | | | Fix typos in the Lib directory as identified by codespell. Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>