summaryrefslogtreecommitdiffstats
path: root/Lib/test/support
Commit message (Collapse)AuthorAgeFilesLines
* [3.7] bpo-41009: fix requires_OS_version() class decorator (GH-20942) (GH-20949)Christian Heimes2020-06-251-19/+19
| | | | | | | | Signed-off-by: Christian Heimes <christian@python.org> Automerge-Triggered-By: @tiran. (cherry picked from commit bb6ec14479f18c32e71e43f2785f177aa17aabbd) Co-authored-by: Christian Heimes <christian@python.org>
* Update libregrtest from master (GH-19517)Victor Stinner2020-04-141-12/+38
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * bpo-36670: regrtest bug fixes (GH-16537) * Fix TestWorkerProcess.__repr__(): start_time is only valid if _popen is not None. * Fix _kill(): don't set _killed to True if _popen is None. * _run_process(): only set _killed to False after calling run_test_in_subprocess(). (cherry picked from commit 2ea71a07d0a720707094ee55f78fd232c40724bc) * [3.8] Update libregrtest from master (GH-19516) * bpo-37531: regrtest now catchs ProcessLookupError (GH-16827) Fix a warning on a race condition on TestWorkerProcess.kill(): ignore silently ProcessLookupError rather than logging an useless warning. (cherry picked from commit a661392f8fb5ac4fc095aa1845d1eb7a25c4e9be) * bpo-38502: regrtest uses process groups if available (GH-16829) test.regrtest now uses process groups in the multiprocessing mode (-jN command line option) if process groups are available: if os.setsid() and os.killpg() functions are available. (cherry picked from commit ecb035cd14c11521276343397151929a94018a22) * bpo-37957: Allow regrtest to receive a file with test (and subtests) to 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. (cherry picked from commit e0cd8aa70a3ce19c3d3712568940aa0cbd9aa97b) * regrtest: log timeout at startup (GH-19514) Reduce also worker timeout. (cherry picked from commit 4cf65a630a8d45bad3fe5cdc4c2632ec64e7ba27) Co-authored-by: Pablo Galindo <Pablogsal@gmail.com> (cherry picked from commit 67b8a1f0f0f78ec38b8626fa9f5b2f5a55c17e15) * bpo-36842: Fix reference leak in tests by running out-of-proc (GH-13556) (cherry picked from commit 9ddc416e9f6635376312c3615193f19480ac772a) * Backport libregrtest changes from master Co-authored-by: Steve Dower <steve.dower@python.org>
* bpo-37583: Add err 113 to support.get_socket_conn_refused_errs() (GH-15259)Hai Shi2019-08-141-0/+3
| | | | Add error number 113 EHOSTUNREACH to get_socket_conn_refused_errs() of test.support.
* [3.7] bpo-37685: Fixed comparisons of datetime.timedelta and ↵Serhiy Storchaka2019-08-041-0/+37
| | | | | | | | | | datetime.timezone. (GH-14996) (GH-15104) There was a discrepancy between the Python and C implementations. Add singletons ALWAYS_EQ, LARGEST and SMALLEST in test.support to test mixed type comparison. (cherry picked from commit 17e52649c0e7e9389f1cc2444a53f059e24e6bca)
* [3.7] Fix typos in docs, comments and test assert messages (GH-14872). (#14901)Kyle Stanley2019-07-221-1/+1
| | | | | (cherry picked from commit 96e12d5f4f3c5a20986566038ee763dff3c228a1) Co-authored-by: Min ho Kim <minho42@gmail.com>
* Revert "Remove unused imports in tests (GH-14518) (GH-14522)" (GH-14555)Victor Stinner2019-07-021-0/+2
| | | This reverts commit e34b5f4d6483187969d5149c801d056b72ef2ddb.
* Remove unused imports in tests (GH-14518) (GH-14522)Victor Stinner2019-07-011-2/+0
| | | (cherry picked from commit 8f4ef3b019ce380022018587571b0f970e668de3)
* [3.7] bpo-36766: Typos in docs and code comments (GH-13116). (GH-13136)penguindustin2019-05-061-1/+1
| | | | | | | | | | | (cherry picked from commit 964663089547ca110199e23867b46b07ff4be88c) Co-authored-by: penguindustin <penguindustin@gmail.com> https://bugs.python.org/issue36766
* bpo-36629: Add support.get_socket_conn_refused_errs() (GH-12834) (GH-12835)Miss Islington (bot)2019-04-151-0/+16
| | | | | | | Fix test_imap4_host_default_value() of test_imaplib: catch also errno.ENETUNREACH error. (cherry picked from commit 3c7931e514faf509a39c218c2c9f55efb434628f) Co-authored-by: Victor Stinner <vstinner@redhat.com>
* bpo-36019: Use pythontest.net instead of example.com in network tests (GH-11941)Miss Islington (bot)2019-02-221-0/+4
| | | | | (cherry picked from commit a40681dd5db8deaf05a635eecb91498dac882aa4) Co-authored-by: Stéphane Wirtel <stephane@wirtel.be>
* bpo-35283: Add pending deprecation warning for Thread.isAlive (GH-11604)Dong-hee Na2019-01-181-2/+2
| | | Add a pending deprecated warning for the threading.Thread.isAlive() method.
* bpo-35519: Rename test.bisect to test.bisect_cmd (GH-11200)Miss Islington (bot)2018-12-171-1/+1
| | | | | | | | Rename test.bisect module to test.bisect_cmd to avoid conflict with bisect module when running directly a test like "./python Lib/test/test_xmlrpc.py". (cherry picked from commit 1dd035954bb03c41b954ebbd63969b4bcb0e106e) Co-authored-by: Victor Stinner <vstinner@redhat.com>
* bpo-35513: Replace time.time() with time.monotonic() in tests (GH-11182)Miss Islington (bot)2018-12-171-2/+2
| | | | | | | | | | Replace time.time() with time.monotonic() in tests to measure time delta. test_zipfile64: display progress every minute (60 secs) rather than every 5 minutes (5*60 seconds). (cherry picked from commit 2cf4c202ffeb30787c944365ba54013688b854c2) Co-authored-by: Victor Stinner <vstinner@redhat.com>
* bpo-34279: regrtest consider that skipped tests are ran (GH-11132)Miss Islington (bot)2018-12-141-1/+1
| | | | | | | | | bpo-34279, bpo-35412: support.run_unittest() no longer raises TestDidNotRun if a test result contains skipped tests. The exception is now only raised if no test have been run and no test have been skipped. (cherry picked from commit 3a8f4fef4a4dd0e4a800545468eef9542e126181) Co-authored-by: Victor Stinner <vstinner@redhat.com>
* bpo-33709: test_ntpath and test_posixpath fail in Windows with ACP!=1252. ↵Miss Islington (bot)2018-12-061-1/+5
| | | | | | | (GH-7278) (cherry picked from commit 8752dfbd1f0c96ca09cdacabaf0d0f8c3895b6ce) Co-authored-by: native-api <ivan_pozdeev@mail.ru>
* [3.7] bpo-34279: Synchronize regrtest with master (GH-10800)Victor Stinner2018-11-291-1/+6
| | | | | | | | | | | | | * bpo-34605, libregrtest: Rename --slaveargs to --worker-args (GH-9099) Rename also run_tests_slave() to run_tests_worker(). (cherry picked from commit 012f5b968a738b15ae9b40c499a1c0778b0615a9) * bpo-34279, regrtest: Issue a warning if no tests have been executed (GH-10150) (cherry picked from commit 9724348b43a9005a449ba532ccd3c6726f031097) * test_regrtest: remove unused threading import
* bpo-34945: Buffer output in test suite only when creating junit file (GH-10204)Miss Islington (bot)2018-10-292-14/+16
| | | | | | | | | | | | | | After commit d0f49d2f5085ca68e3dc8725f1fb1c9674bfb5ed, the output of the test suite is always buffered as the test output needs to be included in the JUnit file in same cases (as when a test fails). This has the consequence that printing or using debuggers (like pdb) in the test suite does not result in a good user experience anymore. This commit modifies the test suite runner so it only captures the test output when the JUnit file is requested to fix the regression so prints and debuggers are usable again. (cherry picked from commit 02277482ea765335e497ecd9661d4bde9b5ddc67) Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
* bpo-19756: Prevent test failures due to EADDRNOTAVAIL (GH-9446)Miss Islington (bot)2018-09-201-0/+3
| | | | | (cherry picked from commit 8213eaddf3ce8e87564d2949454903a1484748b5) Co-authored-by: Berker Peksag <berker.peksag@gmail.com>
* bpo-34582: Adds JUnit XML output for regression tests (GH-9210)Miss Islington (bot)2018-09-182-5/+214
| | | | | (cherry picked from commit d0f49d2f5085ca68e3dc8725f1fb1c9674bfb5ed) Co-authored-by: Steve Dower <steve.dower@microsoft.com>
* bpo-33773: Fix test.support.fd_count() on Linux/FreBSD (GH-7421)Miss Islington (bot)2018-06-061-8/+10
| | | | | | | | | | | | 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. (cherry picked from commit 492d6424a7ca907c8ec1df21e51062e8f3d88e32) Co-authored-by: Victor Stinner <vstinner@redhat.com>
* bpo-33522: Enable CI builds on Visual Studio Team Services (GH-6865) (GH-6926)Miss Islington (bot)2018-05-171-1/+21
| | | | | (cherry picked from commit e5f41d2f1e0b8b8e61d5fa427c19bd1ea90fd9a3) Co-authored-by: Steve Dower <steve.dower@microsoft.com>
* Fix spelling typo (GH-6443) (GH-6507)Miss Islington (bot)2018-04-171-1/+1
| | | | | (cherry picked from commit 28e8b66d6c632552765b5fb4573b7f3c9decc3c1) Co-authored-by: jdemeyer <jdemeyer@cage.ugent.be>
* bpo-33053: -m now adds *starting* directory to sys.path (GH-6231) (#6236)Nick Coghlan2018-03-251-1/+2
| | | | | | | | | | | | | | Historically, -m added the empty string as sys.path zero, meaning it resolved imports against the current working directory, the same way -c and the interactive prompt do. This changes the sys.path initialisation to add the *starting* working directory as sys.path[0] instead, such that changes to the working directory while the program is running will have no effect on imports when using the -m switch. (cherry picked from commit d5d9e02dd3c6df06a8dd9ce75ee9b52976420a8b)
* bpo-32964: Reuse a testing implementation of the path protocol in tests. ↵Miss Islington (bot)2018-03-021-0/+18
| | | | | | | (GH-5930) (cherry picked from commit b21d155f57d284aecf9092a9bd24258293965c2f) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* bpo-30028: make test.support.temp_cwd() fork-safe (GH-1066)Miss Islington (bot)2018-02-231-1/+5
| | | | | | | Make test.support.temp_cwd() fork-safe. The context manager test.support.temp_cwd() no longer removes the temporary directory when executing in a process other than the parent it entered from. If a forked child exits the context manager it won't do the cleanup. (cherry picked from commit 33dddac00ba8d9b72cf21b8698504077eb3c23ad) Co-authored-by: Anselm Kruis <a.kruis@science-computing.de>
* [3.7] Improves the ability to build in CI (GH-5729)Miss Islington (bot)2018-02-181-1/+8
|
* bpo-28668: test.support.requires_multiprocessing_queue is removed (GH-4560)xdegaye2017-12-011-18/+1
| | | | Skip tests with test.support.import_module('multiprocessing.synchronize') instead when the semaphore implementation is broken or missing.
* bpo-32030: Rework memory allocators (#4625)Victor Stinner2017-11-291-0/+5
| | | | | | | | | | | | | | | | | | | | * Fix _PyMem_SetupAllocators("debug"): always restore allocators to the defaults, rather than only caling _PyMem_SetupDebugHooks(). * Add _PyMem_SetDefaultAllocator() helper to set the "default" allocator. * Add _PyMem_GetAllocatorsName(): get the name of the allocators * main() now uses debug hooks on memory allocators if Py_DEBUG is defined, rather than calling directly malloc() * Document default memory allocators in C API documentation * _Py_InitializeCore() now fails with a fatal user error if PYTHONMALLOC value is an unknown memory allocator, instead of failing with a fatal internal error. * Add new tests on the PYTHONMALLOC environment variable * Add support.with_pymalloc() * Add the _testcapi.WITH_PYMALLOC constant and expose it as support.with_pymalloc(). * sysconfig.get_config_var('WITH_PYMALLOC') doesn't work on Windows, so replace it with support.with_pymalloc(). * pythoninfo: add _testcapi collector for pymem
* bpo-32138: Skip on Android test_faulthandler tests that raise SIGSEGV (GH-4604)xdegaye2017-11-291-15/+2
| | | | Remove the test.support.requires_android_level decorator.
* bpo-28684: asyncio tests handle PermissionError raised on binding unix ↵xdegaye2017-11-241-0/+23
| | | | | | | | | sockets (GH-4503) The test.support.skip_unless_bind_unix_socket() decorator is used to skip asyncio tests that fail because the platform lacks a functional bind() function for unix domain sockets (as it is the case for non root users on the recent Android versions that run now SELinux in enforcing mode).
* bpo-31324: Fix test.support.set_match_tests(None) (#4505)Victor Stinner2017-11-221-0/+2
|
* bpo-31324: Optimize support._match_test() (#4421)Victor Stinner2017-11-211-12/+55
| | | | | | | | | | | * Rename support._match_test() to support.match_test(): make it public * Remove support.match_tests global variable. It is replaced with a new support.set_match_tests() function, so match_test() doesn't have to check each time if patterns were modified. * Rewrite match_test(): use different code paths depending on the kind of patterns for best performances. Co-Authored-By: Serhiy Storchaka <storchaka@gmail.com>
* bpo-28759: Skip some tests on PermissionError raised by Android (GH-4350)xdegaye2017-11-121-2/+1
| | | | | | Access to mkfifo(), mknod() and hard link creation is controled by SELinux on Android. Also remove test.support.android_not_root.
* Fix miscellaneous typos (#4275)luzpaz2017-11-051-1/+1
|
* bpo-31629: Add support.SaveSignals (#4183)Victor Stinner2017-10-311-0/+39
| | | | | test_curses now saves/restores signals. On FreeBSD, the curses module sets handlers of some signals, but don't restore old handlers when the module is deinitialized.
* Trivial cleanups following bpo-31370 (#3649)Antoine Pitrou2017-09-181-1/+0
| | | | | | * Trivial cleanups following bpo-31370 * Also cleanup the "importlib._bootstrap_external" module
* bpo-31234: Add support.join_thread() helper (#3587)Victor Stinner2017-09-141-0/+10
| | | | join_thread() joins a thread but raises an AssertionError if the thread is still alive after timeout seconds.
* bpo-31234: Add test.support.wait_threads_exit() (#3578)Victor Stinner2017-09-141-0/+35
| | | | Use _thread.count() to wait until threads exit. The new context manager prevents the "dangling thread" warning.
* bpo-31234: threading_cleanup() now warns immediately (#3138)Victor Stinner2017-09-131-9/+19
| | | | | | support.threading_cleanup() waits for 1 second before emitting a warning if there are threads running in the background. With this change, it now emits the warning immediately, to be able to catch bugs more easily.
* bpo-29639: change test.support.HOST to "localhost"Gregory P. Smith2017-09-091-3/+2
| | | | | | | | | | test.support.HOST should be "localhost" as it was in the past. See the bpo-29639. Tests that need the IP address should use HOSTv4 (added) or the existing HOSTv6 constant. This changes the definition and fixes tests that needed updating to deal with HOST being the hostname rather than the hardcoded IP address. This is only the first step in addressing https://bugs.python.org/issue29639.
* bpo-31370: Remove support for threads-less builds (#3385)Antoine Pitrou2017-09-071-14/+3
| | | | | | * Remove Setup.config * Always define WITH_THREAD for compatibility.
* Enhance support.reap_children() (#3036)Victor Stinner2017-08-101-12/+21
| | | | | | | * reap_children() now sets environment_altered to True to detect bugs using python3 -m test --fail-env-changed * Replace bare "except:" with "except OSError:" in reap_children() * Write an unit test for reap_children() using a timeout of 60 seconds
* bpo-31009: Fix support.fd_count() on Windows (#2862)Victor Stinner2017-07-251-16/+42
| | | | | | | | | | * bpo-31009: Fix support.fd_count() on Windows On Windows, test.support.fd_count() now calls msvcrt.CrtSetReportMode() to not kill the process nor log any error on stderr on os.dup(fd) if the file descriptor is invalid. * Fix for release mode
* bpo-26732: fix too many fds in processes started with the "forkserver" ↵Antoine Pitrou2017-07-221-1/+32
| | | | | | | | | | method (#2813) * bpo-26732: fix too many fds in processes started with the "forkserver" method A child process would inherit as many fds as the number of still-running children. * Add blurb and test comment
* bpo-30845: Enhance test_concurrent_futures cleanup (#2564)Victor Stinner2017-07-041-1/+2
| | | | | | | | | | | * bpo-30845: reap_children() now logs warnings * bpo-30845: Enhance test_concurrent_futures cleanup In setUp() and tearDown() methods of test_concurrent_futures tests, make sure that tests don't leak threads nor processes. Clear explicitly the reference to the executor to make it that it's destroyed (to prevent "dangling threads" warning).
* threading_cleanup() failure marks test as ENV_CHANGED (#2500)Victor Stinner2017-06-301-0/+12
| | | | | | | If threading_cleanup() fails to cleanup threads, set a a new support.environment_altered flag to true, flag uses by save_env which is used by regrtest to check if a test altered the environment. At the end, the test file fails with ENV_CHANGED instead of SUCCESS, to report that it altered the environment.
* bpo-30523: regrtest --list-cases --match (#2401)Victor Stinner2017-06-261-14/+18
| | | | | | | * regrtest --list-cases now supports --match and --match-file options. Example: ./python -m test --list-cases -m FileTests test_os * --list-cases now also sets support.verbose to False to prevent messages to stdout when loading test modules. * Add support._match_test() private function.
* bpo-28180: Implementation for PEP 538 (#659)Nick Coghlan2017-06-111-26/+30
| | | | | | | | | | - new PYTHONCOERCECLOCALE config setting - coerces legacy C locale to C.UTF-8, C.utf8 or UTF-8 by default - always uses C.UTF-8 on Android - uses `surrogateescape` on stdin and stdout in the coercion target locales - configure option to disable locale coercion at build time - configure option to disable C locale warning at build time
* bpo-30540: regrtest: add --matchfile option (#1909)Victor Stinner2017-06-091-2/+8
| | | | | | | | | | | | | | | * Add a new option taking a filename to get a list of test names to filter tests. * support.match_tests becomes a list. * Modify run_unittest() to accept to match the whole test identifier, not just a part of a test identifier. For example, the following command only runs test_default_timeout() of the BarrierTests class of test_threading: $ ./python -m test -v test_threading -m test.test_threading.BarrierTests.test_default_timeout Remove also some empty lines from test_regrtest.py to make flake8 tool happy.
* bpo-30197: Enhance functions swap_attr() and swap_item() in test.support. ↵Serhiy Storchaka2017-04-281-4/+12
| | | | | | | | | | | | | (#1341) * bpo-30197: Enhance functions swap_attr() and swap_item() in test.support. They now work when delete replaced attribute or item inside the with statement. The old value of the attribute or item (or None if it doesn't exist) now will be assigned to the target of the "as" clause, if there is one. * Update docstrings.