summaryrefslogtreecommitdiffstats
path: root/Lib/test/support
Commit message (Collapse)AuthorAgeFilesLines
* [3.13] gh-127873: Only check `sys.flags.ignore_environment` for `PYTHON*` ↵Hugo van Kemenade2025-01-221-0/+11
| | | | env vars (GH-127877) (#129138)
* [3.13] gh-128595: Default to stdout isatty for colour detection instead of ↵Hugo van Kemenade2025-01-211-1/+1
| | | | | | | | | stderr (GH-128498) (#129057) Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com> Co-authored-by: Serhiy Storchaka <storchaka@gmail.com> Co-authored-by: Victor Stinner <vstinner@python.org> Fix `test__colorize` unexpected keyword argument 'file' on buildbots (#129070)
* [3.13] gh-71339: Add additional assertion methods in test.support ↵Serhiy Storchaka2025-01-201-0/+57
| | | | | | | | | | | | (GH-128707) (GH-128815) Add a mix-in class ExtraAssertions containing the following methods: * assertHasAttr() and assertNotHasAttr() * assertIsSubclass() and assertNotIsSubclass() * assertStartsWith() and assertNotStartsWith() * assertEndsWith() and assertNotEndsWith() (cherry picked from commit 06cad77a5b345adde88609be9c3c470c5cd9f417)
* [3.13] gh-128595: Add test class helper to force no terminal colour ↵Hugo van Kemenade2025-01-131-16/+31
| | | | | | (GH-128687) (#128778) Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
* [3.13] GH-126789: fix some sysconfig data on late site initializationsMiss Islington (bot)2024-11-171-0/+70
| | | | Co-authored-by: Filipe Laíns 🇵🇸 <lains@riseup.net>
* [3.13] gh-126413: Add translation tests for getopt and optparse (GH-126698) ↵Tomas R.2024-11-151-0/+63
| | | | | (GH-126755) (cherry picked from commit dff074d1446bab23578a6b228b0c59a17006299c)
* [3.13] gh-125041: test_zlib: For s390x HW acceleration, only skip checking ↵Miss Islington (bot)2024-10-161-3/+3
| | | | | | | the compressed bytes (GH-125042) (#125527) (cherry picked from commit cc5a225cdc2a5d4e035dd08d59cef39182c10a6c) Co-authored-by: Petr Viktorin <encukou@gmail.com>
* [3.13] gh-61698: Use launchctl to detect macOS window manager in tests ↵Miss Islington (bot)2024-10-131-15/+9
| | | | | | | (GH-118390) (#125392) (cherry picked from commit ce740d46246b28bb675ba9d62214b59be9b8411e) Co-authored-by: Erlend E. Aasland <erlend@python.org>
* [3.13] gh-53203: Improve tests for strptime() (GH-125090) (GH-125091)Miss Islington (bot)2024-10-081-4/+49
| | | | | | | | | | | | | Run them with different locales and different date and time. Add the @run_with_locales() decorator to run the test with multiple locales. Improve the run_with_locale() context manager/decorator -- it now catches only expected exceptions and reports the test as skipped if no appropriate locale is available. (cherry picked from commit 19984fe024bfd90649f1c36b78c9abf3ed72b27d) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* [3.13] gh-124842: Fix test.support.import_helper.make_legacy_pyc() ↵Miss Islington (bot)2024-10-071-2/+2
| | | | | | | | | (GH-124843) (GH-124853) For source file "path/to/file.py" it created file with incorrect path "/absolute/path/to/path/to/file.pyc" instead of "path/to/file.pyc". (cherry picked from commit 60ff67d010078eca15a74b1429caf779ac4f9c74) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* [3.13] gh-124188: Fix PyErr_ProgramTextObject() (GH-124189) (GH-124423)Miss Islington (bot)2024-10-071-3/+7
| | | | | | | | | | * Detect source file encoding. * Use the "replace" error handler even for UTF-8 (default) encoding. * Remove the BOM. * Fix detection of too long lines if they contain NUL. * Return the head rather than the tail for truncated long lines. (cherry picked from commit e2f710792b0418b8ca1ca3b8cdf39588c7268495) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* [3.13] gh-121039: add Floats/ComplexesAreIdenticalMixin to ↵Sergey B Kirpichev2024-09-301-0/+40
| | | | | | | | | | test.support.testcase (GH-121071) (#123840) * [3.13] gh-121039: add Floats/ComplexesAreIdenticalMixin to test.support.testcase (GH-121071) (cherry picked from commit 8ef8354ef15e00d484ac2ded9442b789c24b11e0) Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com> * +1
* [3.13] gh-101525: Skip test_gdb if the binary is relocated by BOLT. ↵Miss Islington (bot)2024-09-021-0/+9
| | | | | | | | (gh-118572) (#123601) gh-101525: Skip test_gdb if the binary is relocated by BOLT. (gh-118572) (cherry picked from commit f95fc4de115ae03d7aa6dece678240df085cb4f6) Co-authored-by: Donghee Na <donghee.na@python.org>
* [3.13] gh-123142: fix too wide source location of GET_ITER/GET_AITER ↵Irit Katriel2024-08-281-1/+4
| | | | | (GH-123420). (#123435) (cherry picked from commit 61bef6245c4a32bf430d684ede8603f423d63284)
* [3.13] gh-123142: Fix too wide source locations in tracebacks of exceptions ↵Irit Katriel2024-08-221-1/+16
| | | | | from broken iterables in comprehensions (GH-123173). (#123209) (cherry picked from commit ec89620e5e147ba028a46dd695ef073a72000b84)
* [3.13] gh-117482: Fix the Slot Wrapper Inheritance Tests (gh-122249)Eric Snow2024-07-291-0/+55
| | | | | The tests were only checking cases where the slot wrapper was present in the initial case. They were missing when the slot wrapper was added in the additional initializations. This fixes that. (cherry-picked from commit 490e0ad83ac72c5688dfbbab4eac61ccfd7be5fd, AKA gh-122248)
* [3.13] gh-120678: pyrepl: Include globals from modules passed with `-i` ↵Miss Islington (bot)2024-07-171-1/+5
| | | | | | | | (GH-120904) (#121916) (cherry picked from commit ac07451116d52dd6a5545d27b6a2e3737ed27cf0) Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com> Co-authored-by: Łukasz Langa <lukasz@langa.pl>
* [3.13] gh-76785: Expand How Interpreter Channels Handle Interpreter ↵Miss Islington (bot)2024-07-153-63/+209
| | | | | | | | | Finalization (gh-121811) See 6b98b274b6 for an explanation of the problem and solution. Here I've applied the solution to channels. (cherry picked from commit 8b209fd4f8a9bf9603888bda2c44b5cfd4ebf47a, AKA gh-121805) Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com>
* [3.13] gh-76785: Expand How Interpreter Queues Handle Interpreter ↵Miss Islington (bot)2024-07-151-13/+128
| | | | | | | | | | | | | | | | | | | | | | | | Finalization (gh-121807) Any cross-interpreter mechanism for passing objects between interpreters must be very careful to respect isolation, even when the object is effectively immutable (e.g. int, str). Here this especially relates to when an interpreter sends one of its objects, and then is destroyed while the inter-interpreter machinery (e.g. queue) still holds a reference to the object. When I added interpreters.Queue, I dealt with that case (using an atexit hook) by silently removing all items from the queue that were added by the finalizing interpreter. Later, while working on concurrent.futures.InterpreterPoolExecutor (gh-116430), I noticed it was somewhat surprising when items were silently removed from the queue when the originating interpreter was destroyed. (See my comment on that PR.) It took me a little while to realize what was going on. I expect that users, which much less context than I have, would experience the same pain. My approach, here, to improving the situation is to give users three options: 1. return a singleton (interpreters.queues.UNBOUND) from Queue.get() in place of each removed item 2. raise an exception (interpreters.queues.ItemInterpreterDestroyed) from Queue.get() in place of each removed item 3. existing behavior: silently remove each item (i.e. Queue.get() skips each one) The default will now be (1), but users can still explicitly opt in any of them, including to the silent removal behavior. The behavior for each item may be set with the corresponding Queue.put() call. and a queue-wide default may be set when the queue is created. (This is the same as I did for "synconly".) (cherry picked from commit 6b98b274b60a15b490d2ea85069638c037b2a9cd, AKA gh-116431) Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com>
* [3.13] gh-121571: Do not use `EnvironmentError` in tests, use `OSError` ↵Miss Islington (bot)2024-07-101-1/+1
| | | | | | | | instead (GH-121572) (#121574) gh-121571: Do not use `EnvironmentError` in tests, use `OSError` instead (GH-121572) (cherry picked from commit e2822360da30853f092d8a50ad83e52f6ea2ced9) Co-authored-by: sobolevn <mail@sobolevn.me>
* [3.13] gh-121016: Add test for PYTHON_BASIC_REPL envioronment variable ↵devdanzin2024-06-261-0/+6
| | | | | | | | | | | | (GH-121017) (#121064) * gh-121016: Add test for `PYTHON_BASIC_REPL` envioronment variable (#121017) (cherry picked from commit 9e45fd9858a059950f7387b4fda2b00df0e8e537) * [3.13] gh-121016: Add test for `PYTHON_BASIC_REPL` envioronment variable (GH-121017) (cherry picked from commit 9e45fd9858a059950f7387b4fda2b00df0e8e537) Co-authored-by: devdanzin <74280297+devdanzin@users.noreply.github.com>
* [3.13] gh-117398: Add datetime C-API type check test for subinterpreters ↵Miss Islington (bot)2024-06-131-1/+1
| | | | | | | | | (gh-120463) Check if the DateTime C-API type matches the datetime.date type on main and shared/isolated subinterpreters. (cherry picked from commit 50a389565aa0b480792ed06a2ab56fb5a72fc2d8, AKA gh-119604) Co-authored-by: neonene <53406459+neonene@users.noreply.github.com>
* [3.13] gh-117657: Fix race involving immortalizing objects (GH-119927) (#120005)Sam Gross2024-06-031-2/+2
| | | | | | | | | | | The free-threaded build currently immortalizes objects that use deferred reference counting (see gh-117783). This typically happens once the first non-main thread is created, but the behavior can be suppressed for tests, in subinterpreters, or during a compile() call. This fixes a race condition involving the tracking of whether the behavior is suppressed. (cherry picked from commit 47fb4327b5c405da6df066dcaa01b7c1aefab313)
* gh-118527: Intern code consts in free-threaded build (#118667)Sam Gross2024-05-071-0/+9
| | | | | | We already intern and immortalize most string constants. In the free-threaded build, other constants can be a source of reference count contention because they are shared by all threads running the same code objects.
* gh-117225: Move colorize functionality to own internal module (#118283)Hugo van Kemenade2024-05-011-4/+5
|
* gh-118201: Accomodate flaky behavior of `os.sysconf` on iOS (GH-118453)Russell Keith-Magee2024-05-011-1/+2
|
* gh-118335: Configure Tier 2 interpreter at build time (#118339)Guido van Rossum2024-05-011-4/+4
| | | | | | | | | | | | | | | | | | | | | | The code for Tier 2 is now only compiled when configured with `--enable-experimental-jit[=yes|interpreter]`. We drop support for `PYTHON_UOPS` and -`Xuops`, but you can disable the interpreter or JIT at runtime by setting `PYTHON_JIT=0`. You can also build it without enabling it by default using `--enable-experimental-jit=yes-off`; enable with `PYTHON_JIT=1`. On Windows, the `build.bat` script supports `--experimental-jit`, `--experimental-jit-off`, `--experimental-interpreter`. In the C code, `_Py_JIT` is defined as before when the JIT is enabled; the new variable `_Py_TIER2` is defined when the JIT *or* the interpreter is enabled. It is actually a bitmask: 1: JIT; 2: default-off; 4: interpreter.
* gh-117783: Immortalize objects that use deferred reference counting (#118112)Sam Gross2024-04-291-0/+19
| | | | | | | | | Deferred reference counting is not fully implemented yet. As a temporary measure, we immortalize objects that would use deferred reference counting to avoid multi-threaded scaling bottlenecks. This is only performed in the free-threaded build once the first non-main thread is started. Additionally, some tests, including refleak tests, suppress this behavior.
* gh-118351: Adapt support.TEST_MODULES_ENABLED for builds without the config ↵Kirill Podoprigora2024-04-291-2/+3
| | | | variable (GH-118354)
* gh-112730: Make the test suite resilient to color-activation environment ↵Pablo Galindo Salgado2024-04-241-0/+20
| | | | variables (#117672)
* gh-76785: Rename _xxsubinterpreters to _interpreters (gh-117791)Eric Snow2024-04-244-7/+7
| | | See https://discuss.python.org/t/pep-734-multiple-interpreters-in-the-stdlib/41147/26.
* gh-117225: Add color to doctest output (#117583)Hugo van Kemenade2024-04-241-1/+1
| | | | Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
* gh-117680: make _PyInstructionSequence a PyObject and use it in tests (#117629)Irit Katriel2024-04-171-44/+41
|
* gh-76785: Handle Legacy Interpreters Properly (gh-117490)Eric Snow2024-04-111-23/+56
| | | This is similar to the situation with threading._DummyThread. The methods (incl. __del__()) of interpreters.Interpreter objects must be careful with interpreters not created by interpreters.create(). The simplest thing to start with is to disable any method that modifies or runs in the interpreter. As part of this, the runtime keeps track of where an interpreter was created. We also handle interpreter "refcounts" properly.
* gh-117649: Raise ImportError for unsupported modules in free-threaded build ↵Sam Gross2024-04-111-0/+6
| | | | | | | | | | (#117651) The free-threaded build does not currently support the combination of single-phase init modules and non-isolated subinterpreters. Ensure that `check_multi_interp_extensions` is always `True` for subinterpreters in the free-threaded build so that importing these modules raises an `ImportError`.
* gh-76785: Add More Tests to test_interpreters.test_api (gh-117662)Eric Snow2024-04-111-3/+4
| | | In addition to the increase test coverage, this is a precursor to sorting out how we handle interpreters created directly via the C-API.
* gh-116303: Skip tests if C recursion limit is unavailable (GH-117368)Erlend E. Aasland2024-04-081-12/+8
| | | | | The test suite fetches the C recursion limit from the _testcapi extension module. Test extension modules can be disabled using the --disable-test-modules configure option.
* gh-117478: Add `@support.requires_gil_enabled` decorator (#117479)Sam Gross2024-04-041-1/+6
| | | Co-authored-by: Kirill Podoprigora <kirill.bast9@mail.ru>
* gh-76785: Raise InterpreterError, Not RuntimeError (gh-117489)Eric Snow2024-04-031-2/+2
| | | | | I had meant to switch everything to InterpreterError when I added it a while back. At the time I missed a few key spots. As part of this, I've added print-the-exception to _PyXI_InitTypes() and fixed an error case in `_PyStaticType_InitBuiltin().
* gh-116303: Skip test module dependent tests if test modules are unavailable ↵Erlend E. Aasland2024-04-031-0/+4
| | | | (#117341)
* gh-76785: Consolidate Some Interpreter-related Testing Helpers (gh-117485)Eric Snow2024-04-021-4/+4
| | | This eliminates the duplication of functionally identical helpers in the _testinternalcapi and _xxsubinterpreters modules.
* gh-76785: Add PyInterpreterConfig Helpers (gh-117170)Eric Snow2024-04-021-2/+13
| | | These helpers make it easier to customize and inspect the config used to initialize interpreters. This is especially valuable in our tests. I found inspiration from the PyConfig API for the PyInterpreterConfig dict conversion stuff. As part of this PR I've also added a bunch of tests.
* gh-116303: Handle disabled test modules in test.support helpers (#116482)Erlend E. Aasland2024-03-282-8/+26
| | | | Make sure test.support helpers skip iso. failing if test extension modules are disabled. Also log TEST_MODULES in test.pythoninfo.
* gh-71042: Add `platform.android_ver` (#116674)Malcolm Smith2024-03-271-8/+8
|
* gh-92906: Enable test_cext and test_cppext on Windows (#117000)Victor Stinner2024-03-191-8/+14
| | | | | | | | | | On Windows in release mode, the test_cext and test_cppext can now build C and C++ extensions. * test_cext now also builds the C extension without options. * test_cppext now also builds the C++ extension without options. * Add C++14 test to test_cppext; C++11 is not supported by MSVC. * Make setup_venv_with_pip_setuptools_wheel() quiet when support.verbose is false. Only show stdout and stderr on failure.
* gh-112536: Add test_threading to TSAN tests (#116898)Antoine Pitrou2024-03-161-2/+2
|
* gh-116604: Fix test_gc on free-threaded build (#116662)Sam Gross2024-03-131-0/+10
| | | | | | | | | | The free-threaded GC only does full collections, so it uses a threshold that is a maximum of a fixed value (default 2000) and proportional to the number of live objects. If there were many live objects after the previous collection, then the threshold may be larger than 10,000 causing `test_indirect_calls_with_gc_disabled` to fail. This manually sets the threshold to `(1000, 0, 0)` for the test. The `0` disables the proportional scaling.
* gh-116307: Proper fix for 'mod' leaking across importlib tests (#116680)Jason R. Coombs2024-03-121-0/+12
| | | gh-116307: Create a new import helper 'isolated modules' and use that instead of 'Clean Import' to ensure that tests from importlib_resources don't leave modules in sys.modules.
* gh-71052: Change Android's `sys.platform` from "linux" to "android"Malcolm Smith2024-03-112-2/+2
| | | | Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
* gh-116417: Add _testlimitedcapi C extension (#116419)Victor Stinner2024-03-071-1/+2
| | | | | | | | | | | | | Add a new C extension "_testlimitedcapi" which is only built with the limited C API. Move heaptype_relative.c and vectorcall_limited.c from Modules/_testcapi/ to Modules/_testlimitedcapi/. * configure: add _testlimitedcapi test extension. * Update generate_stdlib_module_names.py. * Update make check-c-globals. Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>