summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_support.py
Commit message (Collapse)AuthorAgeFilesLines
* gh-127146: Emscripten clean up test suite (#127984)Hood Chatham2024-12-171-1/+0
| | | Removed test skips that are no longer required as a result of Emscripten updates.
* gh-127146: Resolve some minor problems in Emscripten tests (#127565)Hood Chatham2024-12-041-1/+1
| | | | Adjusts some Emscripten test exclusions regarding strftime, fma, and stack depth.
* gh-124682: Disable test that is prone to intermittent failure on iOS. (#124683)Russell Keith-Magee2024-09-271-4/+5
| | | Disable test that is prone to intermittent failure on iOS.
* Move get_signal_name() to test.support (#121251)Victor Stinner2024-07-021-0/+12
| | | | | | * Move get_signal_name() from test.libregrtest to test.support. * Use get_signal_name() in support.script_helper. * support.script_helper now decodes stdout and stderr from UTF-8, instead of ASCII, if a command failed.
* gh-120417: Add #noqa: F401 to tests (#120627)Victor Stinner2024-06-181-1/+1
| | | | Ignore linter "imported but unused" warnings in tests when the linter doesn't understand how the import is used.
* GH-112215: Increase C recursion limit for non debug builds (GH-113397)Mark Shannon2023-12-221-1/+1
|
* gh-111165: Move test running code from test.support to libregrtest (GH-111166)Serhiy Storchaka2023-10-251-115/+0
| | | | Remove no longer used functions run_unittest() and run_doctest() from the test.support module.
* gh-110918: regrtest: allow to intermix --match and --ignore options (GH-110919)Serhiy Storchaka2023-10-211-29/+38
| | | | | | | Test case matching patterns specified by options --match, --ignore, --matchfile and --ignorefile are now tested in the order of specification, and the last match determines whether the test case be run or ignored.
* gh-109748: Fix again venv test_zippath_from_non_installed_posix() (#110149)Victor Stinner2023-09-301-1/+1
| | | | | | | Call also copy_python_src_ignore() on listdir() names. shutil.copytree(): replace set() with an empty tuple. An empty tuple becomes a constant in the compiler and checking if an item is in an empty tuple is cheap.
* gh-109615: Look for 'Modules' as landmark for test_copy_python_src_ignore ↵Steve Dower2023-09-291-1/+3
| | | | (GH-110108)
* gh-109615: Fix support test_copy_python_src_ignore() on WASM (#109970)Victor Stinner2023-09-271-1/+9
| | | | Not only check if src_dir exists, but look also for Lib/os.py landmark.
* gh-109615: Fix support test_copy_python_src_ignore() (#109958)Victor Stinner2023-09-271-1/+6
| | | | | | | | | | Fix the test when run on an installed Python: use "abs_srcdir" of sysconfig, and skip the test if the Python source code cannot be found. * Tools/patchcheck/patchcheck.py, Tools/freeze/test/freeze.py and Lib/test/libregrtest/utils.py now first try to get "abs_srcdir" from sysconfig, before getting "srcdir" from sysconfig. * test.pythoninfo logs sysconfig "abs_srcdir".
* gh-109615: Fix test_tools.test_freeze SRCDIR (#109935)Victor Stinner2023-09-271-0/+22
| | | | | | | | | Fix copy_source_tree() function of test_tools.test_freeze: * Don't copy SRC_DIR/build/ anymore. This directory is modified by other tests running in parallel. * Add test.support.copy_python_src_ignore(). * Use sysconfig to get the source directory. * Use sysconfig.get_config_var() to get CONFIG_ARGS variable.
* gh-109162: libregrtest: remove WorkerJob class (#109204)Victor Stinner2023-09-091-2/+39
| | | | | | | | | | | | | | | * Add attributes to Regrtest and RunTests: * gc_threshold * memory_limit * python_cmd * use_resources * Remove WorkerJob class. Add as_json() and from_json() methods to RunTests. A worker process now only uses RunTests for all parameters. * Add tests on support.set_memlimit() in test_support. Create _parse_memlimit() and also adds tests on it. * Remove 'ns' parameter from runtest.py.
* gh-108851: Fix tomllib recursion tests (#108853)Victor Stinner2023-09-061-0/+77
| | | | | | | | | | | * Add get_recursion_available() and get_recursion_depth() functions to the test.support module. * Change infinite_recursion() default max_depth from 75 to 100. * Fix test_tomllib recursion tests for WASI buildbots: reduce the recursion limit and compute the maximum nested array/dict depending on the current available recursion limit. * test.pythoninfo logs sys.getrecursionlimit(). * Enhance test_sys tests on sys.getrecursionlimit() and sys.setrecursionlimit().
* gh-108416: Mark slow test methods with @requires_resource('cpu') (GH-108421)Serhiy Storchaka2023-09-021-0/+1
| | | | Only mark tests which spend significant system or user time, by itself or in subprocesses.
* gh-104835: Remove unittest's deprecated getTestCaseNames, makeSuite, ↵Hugo van Kemenade2023-05-241-3/+0
| | | | findTestCases (#104836)
* gh-104057: Fix direct invocation of test_support (GH-104069)Kirill Podoprigora2023-05-111-1/+1
|
* Add test.support.busy_retry() (#93770)Victor Stinner2022-06-151-11/+1
| | | Add busy_retry() and sleeping_retry() functions to test.support.
* gh-90473: WASI: skip gethostname tests (GH-93092)Christian Heimes2022-05-231-0/+1
| | | | | | - 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.
* gh-90473: Skip tests that don't apply to Emscripten and WASI (GH-92846)Christian Heimes2022-05-161-1/+1
|
* gh-57684: Add -P cmdline option and PYTHONSAFEPATH env var (#31542)Victor Stinner2022-05-051-1/+3
| | | | | | | | | | | | Add the -P command line option and the PYTHONSAFEPATH environment variable to not prepend a potentially unsafe path to sys.path. * Add sys.flags.safe_path flag. * Add PyConfig.safe_path member. * Programs/_bootstrap_python.c uses config.safe_path=0. * Update subprocess._optim_args_from_interpreter_flags() to handle the -P command line option. * Modules/getpath.py sets safe_path to 1 if a "._pth" file is present.
* bpo-40280: Detect missing threading on WASM platforms (GH-32352)Christian Heimes2022-04-071-0/+3
| | | Co-authored-by: Brett Cannon <brett@python.org>
* bpo-40280: Skip more tests on Emscripten (GH-31947)Christian Heimes2022-03-171-0/+3
| | | | | | - lchmod, lchown are not fully implemented - skip umask tests - cannot fstat unlinked or renamed files yet - ignore musl libc issues that affect Emscripten
* bpo-46587: Skip tests if strftime does not support glibc extension (GH-31873)Christian Heimes2022-03-151-0/+6
| | | Co-authored-by: Victor Stinner <vstinner@python.org>
* bpo-40280: Skip subprocess-based tests on wasm32-emscripten (GH-30615)Christian Heimes2022-01-251-0/+1
|
* bpo-40280: Add requires_fork test helper (GH-30622)Christian Heimes2022-01-161-1/+2
|
* bpo-45410: regrtest -W leaves stdout/err FD unchanged (GH-28915)Victor Stinner2021-10-131-12/+2
| | | | | | | | | | | | 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-45229: Remove test_main in many tests (GH-28405)Serhiy Storchaka2021-09-191-5/+1
| | | | | | | | | Instead of explicitly enumerate test classes for run_unittest() use the unittest ability to discover tests. This also makes these tests discoverable and runnable with unittest. load_tests() can be used for dynamic generating tests and adding doctests. setUpModule(), tearDownModule() and addModuleCleanup() can be used for running code before and after all module tests.
* bpo-5846: Deprecate obsolete methods in `unittest` (GH-28299)Erlend Egeberg Aasland2021-09-151-2/+7
| | | Deprecate makeSuite, findTestCases, and getTestCaseNames. Scheduled for removal in Python 3.13.
* bpo-44852: Support ignoring specific DeprecationWarnings wholesale in ↵Łukasz Langa2021-08-161-0/+29
| | | | regrtest (GH-27634)
* bpo-44498: Issue a deprecation warning on asynchat, asyncore and smtpd ↵Barry Warsaw2021-06-241-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | import (#26882) * Issue a deprecation warning on smtpd import * Also issue DeprecationWarnings for asynchat and asyncore * Fix some tests * test___all__ requires the word 'module' or 'package' in the deprecation warning text, so add those to smtpd, asynchat, and asyncore. * In test_support, use pprint now instead of asyncore as the landmark. * Add What's New * Use ..deprecated:: * Use ..deprecated:: * Update Lib/smtpd.py Co-authored-by: Miro Hrončok <miro@hroncok.cz> * Update Doc/library/smtpd.rst Co-authored-by: Miro Hrončok <miro@hroncok.cz> * Import async{hat,ore} after the DeprecationWarning for this module Co-authored-by: Miro Hrončok <miro@hroncok.cz>
* bpo-43651: PEP 597: Fix EncodingWarning in some tests (GH-25142)Inada Naoki2021-04-021-2/+2
| | | | | | | | | | | | | * test__xxsubinterpreters * test_builtin * test_doctest * test_exceptions * test_opcodes * test_support * test_argparse * test_baseexception * test_bdb * test_bool * test_asdl_parser
* bpo-41521: Rename blacklist parameter to not_exported (GH-21824)Victor Stinner2020-08-171-4/+4
| | | | Rename "blacklist" parameter of test.support.check__all__() to "not_exported".
* bpo-40275: Use new test.support helper submodules in tests (GH-21169)Hai Shi2020-06-301-38/+43
|
* bpo-40275: Move TransientResource to test_urllib2net (GH-20812)Victor Stinner2020-06-111-1/+0
| | | | | | Move TransientResource, time_out, socket_peer_reset and ioerror_peer_reset from test.support to test_urllib2net. Remove "import errno" from test.support.
* bpo-40443: Remove unused imports in tests (GH-19805)Victor Stinner2020-04-291-1/+0
|
* 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-1/+23
| | | | | | | 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-40094: Add test.support.wait_process() (GH-19254)Victor Stinner2020-03-311-5/+2
| | | | | | | | | 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-39489: Remove COUNT_ALLOCS special build (GH-18259)Victor Stinner2020-02-031-1/+0
| | | | | | | | | | | Remove: * COUNT_ALLOCS macro * sys.getcounts() function * SHOW_ALLOC_COUNT code in listobject.c * SHOW_TRACK_COUNT code in tupleobject.c * PyConfig.show_alloc_count field * -X showalloccount command line option * @test.support.requires_type_collecting decorator
* bpo-38614: Use test.support.SHORT_TIMEOUT constant (GH-17566)Victor Stinner2019-12-111-1/+1
| | | | | | | | | | | | | | | Replace hardcoded timeout constants in tests with SHORT_TIMEOUT of test.support, so it's easier to ajdust this timeout for all tests at once. SHORT_TIMEOUT is 30 seconds by default, but it can be longer depending on --timeout command line option. The change makes almost all timeouts longer, except test_reap_children() of test_support which is made 2x shorter: SHORT_TIMEOUT should be enough. If this test starts to fail, LONG_TIMEOUT should be used instead. Uniformize also "from test import support" import in some test files.
* bpo-38991: Remove test.support.strip_python_stderr() (GH-17490)Victor Stinner2019-12-081-1/+0
| | | | | test.support: run_python_until_end(), assert_python_ok() and assert_python_failure() functions no longer strip whitespaces from stderr.
* bpo-37957: Allow regrtest to receive a file with test (and subtests) to ↵Pablo Galindo2019-11-191-9/+57
| | | | | | | ignore (GH-16989) When building Python in some uncommon platforms there are some known tests that will fail. Right now, the test suite has the ability to ignore entire tests using the -x option and to receive a filter file using the --matchfile filter. The problem with the --matchfile option is that it receives a file with patterns to accept and when you want to ignore a couple of tests and subtests, is too cumbersome to lists ALL tests that are not the ones that you want to accept and he problem with -x is that is not easy to ignore just a subtests that fail and the whole test needs to be ignored. For these reasons, add a new option to allow to ignore a list of test and subtests for these situations.
* bpo-32972: Async test case (GH-13386)Andrew Svetlov2019-05-291-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add explicit `asyncSetUp` and `asyncTearDown` methods. The rest is the same as for #13228 `AsyncTestCase` create a loop instance for every test for the sake of test isolation. Sometimes a loop shared between all tests can speed up tests execution time a lot but it requires control of closed resources after every test finish. Basically, it requires nested supervisors support that was discussed with @1st1 many times. Sorry, asyncio supervisors have no chance to land on Python 3.8. The PR intentionally does not provide API for changing the used event loop or getting the test loop: use `asyncio.set_event_loop_policy()` and `asyncio.get_event_loop()` instead. The PR adds four overridable methods to base `unittest.TestCase` class: ``` def _callSetUp(self): self.setUp() def _callTestMethod(self, method): method() def _callTearDown(self): self.tearDown() def _callCleanup(self, function, /, *args, **kwargs): function(*args, **kwargs) ``` It allows using asyncio facilities with minimal influence on the unittest code. The last but not least: the PR respects contextvars. The context variable installed by `asyncSetUp` is available on test, `tearDown` and a coroutine scheduled by `addCleanup`. https://bugs.python.org/issue32972
* bpo-35934: Add socket.create_server() utility function (GH-11784)Giampaolo Rodola2019-04-081-4/+2
|
* bpo-34812: subprocess._args_from_interpreter_flags(): add isolated (GH-10675)Victor Stinner2018-11-231-2/+8
| | | | | | | | The "-I" command line option (run Python in isolated mode) is now also copied by the multiprocessing and distutils modules when spawning child processes. Previously, only -E and -s options (enabled by -I) were copied. subprocess._args_from_interpreter_flags() now copies the -I flag.
* bpo-34683: Make SyntaxError column offsets consistently 1-indexed (gh-9338)Ammar Askar2018-09-241-1/+1
| | | | | | Also point to start of tokens in parsing errors. Fixes bpo-34683
* Fixed several assertTrue() that were intended to be assertEqual(). (GH-8191)Sergey Fedoseev2018-07-091-1/+1
| | | Fixed also testing the "always" warning filter.
* bpo-33773: Fix test.support.fd_count() on Linux/FreBSD (GH-7421)Victor Stinner2018-06-061-0/+11
| | | | | | | | | Substract one because listdir() opens internally a file descriptor to list the content of the /proc/self/fd/ directory. Add test_support.test_fd_count(). Move also MAXFD code before msvcrt.CrtSetReportMode(), to make sure that the report mode is always restored on failure.