Commit Graph

132 Commits

Author SHA1 Message Date
Antoine Pitrou 88c60c9668 Trivial cleanups following bpo-31370 (#3649)
* Trivial cleanups following bpo-31370

* Also cleanup the "importlib._bootstrap_external" module
2017-09-18 23:50:44 +02:00
Victor Stinner b9b69003d9 bpo-31234: Add support.join_thread() helper (#3587)
join_thread() joins a thread but raises an AssertionError if the
thread is still alive after timeout seconds.
2017-09-14 14:40:56 -07:00
Victor Stinner ff40ecda73 bpo-31234: Add test.support.wait_threads_exit() (#3578)
Use _thread.count() to wait until threads exit. The new context
manager prevents the "dangling thread" warning.
2017-09-14 13:07:24 -07:00
Victor Stinner ace1ecc00b bpo-31234: threading_cleanup() now warns immediately (#3138)
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.
2017-09-13 13:42:00 -07:00
Gregory P. Smith efb1d0a3c0 bpo-29639: change test.support.HOST to "localhost"
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.
2017-09-09 00:30:15 -07:00
Antoine Pitrou a6a4dc816d bpo-31370: Remove support for threads-less builds (#3385)
* Remove Setup.config
* Always define WITH_THREAD for compatibility.
2017-09-07 18:56:24 +02:00
Victor Stinner b501147980 Enhance support.reap_children() (#3036)
* 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
2017-08-10 16:01:47 +02:00
Victor Stinner 302bbbe9ba bpo-31009: Fix support.fd_count() on Windows (#2862)
* 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
2017-07-25 17:45:53 +02:00
Antoine Pitrou 896145d9d2 bpo-26732: fix too many fds in processes started with the "forkserver" 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
2017-07-22 13:22:54 +02:00
Victor Stinner 3df9dec425 bpo-30845: Enhance test_concurrent_futures cleanup (#2564)
* 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).
2017-07-04 13:14:04 +02:00
Victor Stinner 21a0a6c9f8 threading_cleanup() failure marks test as ENV_CHANGED (#2500)
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.
2017-06-30 10:59:52 +02:00
Victor Stinner ace56d5836 bpo-30523: regrtest --list-cases --match (#2401)
* 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.
2017-06-26 14:18:51 +02:00
Victor Stinner ef8320cf6f bpo-30540: regrtest: add --matchfile option (#1909)
* 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.
2017-06-09 10:18:48 +02:00
Serhiy Storchaka d1a1def7bf bpo-30197: Enhance functions swap_attr() and swap_item() in test.support. (#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.
2017-04-28 18:17:26 +02:00
Victor Stinner d819ad9832 bpo-30107: Make SuppressCrashReport quiet on macOS (#1279)
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
2017-04-26 00:55:08 +02:00
Victor Stinner a36e939aeb bpo-30125: disable faulthandler in ctypes test_SEH (#1237)
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.
2017-04-22 00:31:13 +02:00
Victor Stinner d20324a7fa support.threading_cleanup() log a warning on fail (#1195)
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
2017-04-20 13:40:08 +02:00
Serhiy Storchaka 55fe1ae970 bpo-30022: Get rid of using EnvironmentError and IOError (except test… (#1051) 2017-04-16 10:46:38 +03:00
Victor Stinner 3722f1f483 support: temp_dir() and change_cwd() uses repr() in error message
Serhiy Storshaka pointed me that str(path) can emit a BytesWarning: use
repr(path) instead.
2017-02-08 15:49:10 +01:00
Victor Stinner 04054d9ac2 Update test_support for my temp_dir/change_cwd changes 2017-02-08 12:49:02 +01:00
Victor Stinner edb4881441 support: add more info on temp_dir() and change_cwd() failure
Log the OSError exception message.
2017-02-08 12:25:00 +01:00
Xavier de Gaye 69598527c7 Issue #28683: Merge 3.6. 2016-12-14 11:54:49 +01:00
Xavier de Gaye e88ed05006 Issue #28683: Fix the tests that bind() a unix socket and raise PermissionError
on Android for a non-root user.
2016-12-14 11:52:28 +01:00
Xavier de Gaye f852fff878 Issue #28759: Merge 3.6. 2016-12-13 10:03:34 +01:00
Xavier de Gaye 3a4e989324 Issue #28759: Fix the tests that fail with PermissionError when run as
a non-root user on Android where access rights are controled by SELinux MAC.
2016-12-13 10:00:01 +01:00
Serhiy Storchaka 26817a8490 Issue #28512: Fixed setting the offset attribute of SyntaxError by
PyErr_SyntaxLocationEx() and PyErr_SyntaxLocationObject().
2016-12-11 14:44:21 +02:00
Serhiy Storchaka 8114f21668 Issue #28512: Fixed setting the offset attribute of SyntaxError by
PyErr_SyntaxLocationEx() and PyErr_SyntaxLocationObject().
2016-12-11 14:43:18 +02:00
Serhiy Storchaka 8b58339eb2 Issue #28512: Fixed setting the offset attribute of SyntaxError by
PyErr_SyntaxLocationEx() and PyErr_SyntaxLocationObject().
2016-12-11 14:39:01 +02:00
Xavier de Gaye 566ba3defd Issue #26939: Merge 3.6. 2016-12-08 11:09:54 +01:00
Xavier de Gaye 7522ef402c Issue #26939: Add the support.setswitchinterval() function to fix
test_functools hanging on the Android armv7 qemu emulator.
2016-12-08 11:06:56 +01:00
Serhiy Storchaka 43153e4d49 Issue #28847: dbm.dumb now supports reading read-only files and no longer
writes the index file when it is not changed.
2016-12-07 11:02:18 +02:00
Serhiy Storchaka 520348e5c0 Issue #28847: dbm.dumb now supports reading read-only files and no longer
writes the index file when it is not changed.
2016-12-07 11:00:06 +02:00
Serhiy Storchaka 028ace1ccb Issue #28847: dbm.dumb now supports reading read-only files and no longer
writes the index file when it is not changed.
2016-12-07 10:56:39 +02:00
Victor Stinner d6958ac6c0 Add sys.getandroidapilevel()
Issue #28740: Add sys.getandroidapilevel(): return the build time
API version of Android as an integer.

Function only available on Android.
2016-12-02 01:13:46 +01:00
Serhiy Storchaka 09285e019d Issue #28666: Try to fix removing readonly directories on Windows. 2016-11-20 20:04:54 +02:00
Serhiy Storchaka ba7eb8da09 Issue #28666: Now test.support.rmtree is able to remove unwritable or
unreadable directories on Windows too.
2016-11-20 17:42:58 +02:00
Serhiy Storchaka 2ccb98800a Issue #28666: Now test.support.rmtree is able to remove unwritable or
unreadable directories on Windows too.
2016-11-20 17:42:32 +02:00
Serhiy Storchaka 0e7dbe901c Issue #28666: Now test.support.rmtree is able to remove unwritable or
unreadable directories.
2016-11-20 16:19:20 +02:00
Serhiy Storchaka 6770f8a487 Issue #28666: Now test.support.rmtree is able to remove unwritable or
unreadable directories.
2016-11-20 16:16:06 +02:00
Serhiy Storchaka 9f64de8ba4 Issue #28666: Fix removing readonly directories on Windows. 2016-11-20 20:36:51 +02:00
Serhiy Storchaka bbfe6c3986 Issue #28666: Fix removing readonly directories on Windows. 2016-11-20 20:04:54 +02:00
Xavier de Gaye dfc13e069a Issue 26931: Skip the test_distutils tests using a compiler executable
that is not found
2016-11-17 09:00:19 +01:00
Xavier de Gaye d178e69ad8 Issue 28668: Merge 3.5 2016-11-15 17:03:12 +01:00
Xavier de Gaye 49e8f2d204 Issue 28668: Skip tests where instanciation of multiprocessing.Queue
would raise ImportError
2016-11-15 16:57:52 +01:00
Xavier de Gaye 95aa56a6fb Issue #26934: Handle _ANDROID_API_LEVEL is None on Windows 2016-11-13 21:55:52 +01:00
Xavier de Gaye 6c5f21945a Fix test_faulthandler on Android where raise() exits with 0 2016-11-13 20:46:46 +01:00
Terry Jan Reedy fb5ce7eea1 Issue #27918# test.resource.is_gui_available no longer flashes tk window.
Also, don't run it if 'gui' is not requested.  Patch by Xiang Zhang.
2016-09-05 00:01:34 -04:00
R David Murray 44b548dda8 #27364: fix "incorrect" uses of escape character in the stdlib.
And most of the tools.

Patch by Emanual Barry, reviewed by me, Serhiy Storchaka, and
Martin Panter.
2016-09-08 13:59:53 -04:00
Steve Dower 22d0698d3b Adds test.support.PGO and skips tests that are not useful for PGO. 2016-09-06 19:38:15 -07:00
Larry Hastings 10108a7b9a Issue #27355: Removed support for Windows CE. It was never finished,
and Windows CE is no longer a relevant platform for Python.
2016-09-05 15:11:23 -07:00