summaryrefslogtreecommitdiffstats
path: root/Lib/test/support
Commit message (Collapse)AuthorAgeFilesLines
* bpo-33709: test_ntpath and test_posixpath fail in Windows with ACP!=1252. ↵native-api2018-12-061-1/+5
| | | | (GH-7278)
* bpo-34279, regrtest: Issue a warning if no tests have been executed (GH-10150)Pablo Galindo2018-11-291-1/+6
|
* bpo-34945: Buffer output in test suite only when creating junit file (GH-10204)Pablo Galindo2018-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.
* bpo-32236: open() emits RuntimeWarning if buffering=1 for binary mode (GH-4842)Alexey Izbyshev2018-10-201-5/+27
| | | | | | | | | If buffering=1 is specified for open() in binary mode, it is silently treated as buffering=-1 (i.e., the default buffer size). Coupled with the fact that line buffering is always supported in Python 2, such behavior caused several issues (e.g., bpo-10344, bpo-21332). Warn that line buffering is not supported if open() is called with binary mode and buffering=1.
* bpo-19756: Prevent test failures due to EADDRNOTAVAIL (GH-9446)Berker Peksag2018-09-201-0/+3
|
* bpo-34582: Adds JUnit XML output for regression tests (GH-9210)Steve Dower2018-09-182-5/+214
|
* Lib/test/support: fix typo in docstring (GH-8506)Daniel Hahler2018-09-111-2/+2
|
* bpo-9372: Deprecate several __getitem__ methods (GH-8609)Berker Peksag2018-08-111-0/+17
| | | | | | The __getitem__ methods of DOMEventStream, FileInput, and FileWrapper classes ignore their 'index' parameters and return the next item instead.
* Revert "bpo-33671: Add support.MS_WINDOWS and support.MACOS (GH-7800)" (GH-7919)Victor Stinner2018-06-261-33/+20
| | | This reverts commit 8fbbdf0c3107c3052659e166f73990b466eacbb0.
* bpo-33671: Add support.MS_WINDOWS and support.MACOS (GH-7800)Victor Stinner2018-06-221-20/+33
| | | | | | | | * Add support.MS_WINDOWS: True if Python is running on Microsoft Windows. * Add support.MACOS: True if Python is running on Apple macOS. * Replace support.is_android with support.ANDROID * Replace support.is_jython with support.JYTHON * Cleanup code to initialize unix_shell
* bpo-33773: Fix test.support.fd_count() on Linux/FreBSD (GH-7421)Victor Stinner2018-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.
* test.support.SaveSignals: fix typo (GH-7448)Victor Stinner2018-06-061-1/+1
| | | an => and
* bpo-33562: Check the global asyncio event loop policy isn't set after any ↵Brett Cannon2018-06-021-0/+6
| | | | tests (GH-7328)
* bpo-33522: Enable CI builds on Visual Studio Team Services (#6865)Steve Dower2018-05-161-1/+21
|
* bpo-33332: Add signal.valid_signals() (GH-6581)Antoine Pitrou2018-05-041-1/+1
|
* Fix spelling typo (GH-6443)jdemeyer2018-04-171-1/+1
|
* bpo-33053: -m now adds *starting* directory to sys.path (GH-6231)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.
* bpo-32964: Reuse a testing implementation of the path protocol in tests. (#5930)Serhiy Storchaka2018-03-021-0/+18
|
* bpo-30028: make test.support.temp_cwd() fork-safe (GH-1066)Anselm Kruis2018-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.
* Improves the ability to build in CI (GH-5728)Steve Dower2018-02-181-1/+8
|
* bpo-10544: Disallow "yield" in comprehensions and generator expressions. ↵Serhiy Storchaka2018-02-041-2/+2
| | | | (GH-4564)
* 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.
* bpo-30107: Make SuppressCrashReport quiet on macOS (#1279)Victor Stinner2017-04-251-4/+9
| | | | | | | | | On macOS, SuppressCrashReport now redirects /usr/bin/defaults command stderr into a pipe to not pollute stderr. It fixes a test_io.test_daemon_threads_shutdown_stderr_deadlock() failure when the CrashReporter domain doesn't exists. Message logged into stderr: 2017-04-24 16:57:21.432 defaults[41046:2462851] The domain/default pair of (com.apple.CrashReporter, DialogType) does not exist
* bpo-30125: disable faulthandler in ctypes test_SEH (#1237)Victor Stinner2017-04-211-0/+16
| | | | | | | | Disable faulthandler to run test_SEH() of test_ctypes to prevent the following log with a traceback: Windows fatal exception: access violation Add support.disable_faulthandler() context manager.
* support.threading_cleanup() log a warning on fail (#1195)Victor Stinner2017-04-201-1/+8
| | | | | | | | | | | | The @reap_threads decorator and the threading_cleanup() function of test.support now log a warning if they fail to clenaup threads. Fix also the usage of support.threading_cleanup() in test_urllib2_localnet. The log may help to debug such other warning seen on the AMD64 FreeBSD CURRENT Non-Debug 3.x buildbot: Warning -- threading._dangling was modified by test_logging
* bpo-30022: Get rid of using EnvironmentError and IOError (except test… (#1051)Serhiy Storchaka2017-04-161-1/+1
|
* support: temp_dir() and change_cwd() uses repr() in error messageVictor Stinner2017-02-081-2/+2
| | | | | Serhiy Storshaka pointed me that str(path) can emit a BytesWarning: use repr(path) instead.