Commit Graph

288 Commits

Author SHA1 Message Date
Victor Stinner 7e6977a8bc script_helper: kill the subprocess on error
If Popen.communicate() raises an exception, kill the child process to not leave
a running child process in background and maybe create a zombi process.

This change fixes a ResourceWarning in Python 3.6 when unit tests are
interrupted by CTRL+c.
2016-08-17 12:29:58 +02:00
Xavier de Gaye d141531eb5 Issue #27472: Add test.support.unix_shell as the path to the default shell. 2016-07-22 12:15:29 +02:00
Xavier de Gaye 20bd3b070a Issue #27027: Added test.support.is_android that is True when this is an
Android build.
2016-07-10 18:20:15 +02:00
Serhiy Storchaka bae75cf3fe Issue #19527: Fixed tests with defined COUNT_ALLOCS. 2016-07-03 22:30:49 +03:00
Serhiy Storchaka a793037d80 Issue #19527: Fixed tests with defined COUNT_ALLOCS. 2016-07-03 22:27:26 +03:00
Berker Peksag a67d78e50c Issue #18300: Merge from 3.5 2016-06-24 09:29:21 +03:00
Berker Peksag e495646a97 Issue #18300: Set TERM='' by default in assert_python_* 2016-06-24 09:28:50 +03:00
Berker Peksag 4746080921 Issue #27289: Merge from 3.5 2016-06-12 16:28:16 +03:00
Berker Peksag c74cdc7170 Issue #27289: Prevent test_urllib2net failures due to EOFError raised by ftplib 2016-06-12 16:27:48 +03:00
Serhiy Storchaka ab479c49d3 Issue #26494: Fixed crash on iterating exhausting iterators.
Affected classes are generic sequence iterators, iterators of str, bytes,
bytearray, list, tuple, set, frozenset, dict, OrderedDict, corresponding
views and os.scandir() iterator.
2016-03-30 20:41:15 +03:00
Serhiy Storchaka fbb1c5ee06 Issue #26494: Fixed crash on iterating exhausting iterators.
Affected classes are generic sequence iterators, iterators of str, bytes,
bytearray, list, tuple, set, frozenset, dict, OrderedDict, corresponding
views and os.scandir() iterator.
2016-03-30 20:40:02 +03:00
Victor Stinner e40390473d support.temp_dir(): call support.rmtree() instead of shutil.rmtree() 2016-03-24 17:42:10 +01:00
Serhiy Storchaka 2feb642585 Issue #26325: Added test.support.check_no_resource_warning() to check that
no ResourceWarning is emitted.
2016-02-11 13:12:19 +02:00
Serhiy Storchaka 94a619d48b Issue #26325: Added test.support.check_no_resource_warning() to check that
no ResourceWarning is emitted.
2016-02-11 13:11:44 +02:00
Victor Stinner 9def284387 subprocess._optim_args_from_interpreter_flags()
Issue #26100:

* Add subprocess._optim_args_from_interpreter_flags()
* Add test.support.optim_args_from_interpreter_flags()
* Use new functions in distutils, test_cmd_line_script, test_compileall and
  test_inspect

The change enables test_details() test of test_inspect when -O or -OO command
line option is used.
2016-01-18 12:15:08 +01:00
Gregory P. Smith fcbdf9906b * Re-fix issue #19284: Don't generate the no-op -R command line
parameter to "enable" the always on sys.flags.hash_randomization
  in _args_from_interpreter_flags() used by multiprocessing and
  some unittests.  This simplifies the code.
* assert_python_ok docstring typo fix.
* Fix test_cmd_line not to fail if PYTHONHASHSEED is set to a fixed seed.
2015-12-13 20:15:26 -08:00
Gregory P. Smith 6edadfc9ca * Re-fix issue #19284: Don't generate the no-op -R command line
parameter to "enable" the always on sys.flags.hash_randomization
  in _args_from_interpreter_flags() used by multiprocessing and
  some unittests.  This simplifies the code.
* assert_python_ok docstring typo fix.
* Fix test_cmd_line not to fail if PYTHONHASHSEED is set to a fixed seed.
2015-12-13 20:09:42 -08:00
Martin Panter 36befa5b4c Issue #25626: Merge zlib fix from 3.5 2015-11-21 10:57:15 +00:00
Martin Panter e99e97762c Issue #25626: Change zlib to accept Py_ssize_t and cap to UINT_MAX
The underlying zlib library stores sizes in “unsigned int”. The corresponding
Python parameters are all sizes of buffers filled in by zlib, so it is okay
to reduce higher values to the UINT_MAX internal cap. OverflowError is still
raised for sizes that do not fit in Py_ssize_t.

Sizes are now limited to Py_ssize_t rather than unsigned long, because Python
byte strings cannot be larger than Py_ssize_t. Previously this could result
in a SystemError on 32-bit platforms.

This resolves a regression in the gzip module when reading more than UINT_MAX
or LONG_MAX bytes in one call, introduced by revision 62723172412c.
2015-11-20 08:13:35 +00:00
Martin Panter d226d308a3 Issue #23883: Add test.support.check__all__() and test gettext.__all__
Patches by Jacek Kołodziej.
2015-11-14 11:47:00 +00:00
Martin Panter 2eb819f7a8 Issue #25523: Merge "a" to "an" fixes from 3.4 into 3.5 2015-11-02 04:04:57 +00:00
Martin Panter 7462b64911 Issue #25523: Correct "a" article to "an" article
This changes the main documentation, doc strings, source code comments, and a
couple error messages in the test suite. In some cases the word was removed
or edited some other way to fix the grammar.
2015-11-02 03:37:02 +00:00
Berker Peksag 076dbd0560 Fix remaining tests and remove an unused import. 2015-05-06 07:01:52 +03:00
Berker Peksag ce643913a9 Issue #9517: Move script_helper to the support package.
Patch by Christie Wilson.
2015-05-06 06:33:17 +03:00
Gregory P. Smith 4e72cceb62 issue9859: Document test.support.detect_api_mismatch() and simplify its test. 2015-04-14 13:26:06 -07:00
Gregory P. Smith e334e3ff71 issue9859: Adds a test.support.detect_api_mismatch function useful to
compare the public APIs of two modules or classes.
2015-04-14 12:56:53 -07:00
Brett Cannon f299abdafa Issue #23731: Implement PEP 488.
The concept of .pyo files no longer exists. Now .pyc files have an
optional `opt-` tag which specifies if any extra optimizations beyond
the peepholer were applied.
2015-04-13 14:21:02 -04:00
Berker Peksag d09620839c Skip nntplib tests when transient errors captured. 2015-04-08 11:24:51 +03:00
Berker Peksag 52c0c3382d Skip nntplib tests when transient errors captured. 2015-04-08 11:24:27 +03:00
Serhiy Storchaka 50ef0f41af Escaped backslashes in docstrings. 2015-04-03 18:13:23 +03:00
Serhiy Storchaka 9f8a8910a4 Escaped backslashes in docstrings. 2015-04-03 18:12:41 +03:00
Serhiy Storchaka c05e260ecb Issue #23799: Added test.support.start_threads() for running and cleaning up
multiple threads.
2015-04-01 13:06:18 +03:00
Serhiy Storchaka 263dcd20a3 Issue #23799: Added test.support.start_threads() for running and cleaning up
multiple threads.
2015-04-01 13:01:14 +03:00
Victor Stinner ba508d5dd2 Merge 3.4 (test.support) 2015-03-27 15:36:15 +01:00
Victor Stinner d7aa5248fb Issue #23445: Fix test.support.python_is_optimized() for CFLAGS=-Og
-Og does not optimize the C code, it's just "fast debugging".
2015-03-27 15:36:01 +01:00
Ned Deily ce8f5ded65 Issue #22289: Prevent test_urllib2net failures due to ftp connection timeout. 2015-03-22 01:14:48 -07:00
Ned Deily 2f7bf23925 Issue #22289: merge from 3.4 2015-03-22 01:19:10 -07:00
Antoine Pitrou adb351fcea Issue #20876: correctly close temporary file in test.support.fs_is_case_insensitive() 2015-03-08 00:18:29 +01:00
Antoine Pitrou e3207fe86b Issue #20876: correctly close temporary file in test.support.fs_is_case_insensitive() 2015-03-08 00:15:05 +01:00
Berker Peksag fc080fcc7c Issue #23387: Skip test_issue16464 if it raises an 5xx error.
Also, remove support.run_doctest() since there is no doctests in
test_urllib2 and urllib.request.
2015-03-02 06:01:37 +02:00
Berker Peksag bcdfc6a1fa Issue #23387: Skip test_issue16464 if it raises an 5xx error.
Also, remove support.run_doctest() since there is no doctests in
test_urllib2 and urllib.request.
2015-03-02 06:01:01 +02:00
Steve Dower c55a316cff Issue 23314: SuppressCrashReports now disables CRT assertions
SuppressCrashReports should be used in test subprocesses that test invalid conditions.
2015-02-23 07:56:13 -08:00
Benjamin Peterson 6150804397 handle errors without a reason attribute 2014-11-25 15:43:58 -06:00
Benjamin Peterson 2615e9e293 don't fail tests when www.python.org can't be validated by the system 2014-11-25 15:16:55 -06:00
Berker Peksag 0a2e874eea Issue #17554: Print "fetching <url> ..." messages only in verbose mode.
Patch by Ezio Melotti.
2014-12-10 02:34:11 +02:00
Georg Brandl 72a7f7c476 Try to transfer the Unicode test data files gzipped. 2014-11-06 15:33:30 +01:00
Ned Deily 91f01e175a Issue #22770: Prevent some Tk segfaults on OS X when running gui tests.
When running tests in subprocesses with the regrtest -j option, a bug
in Cocoa Tk can result in a Tcl segfault.  Avoid the problem by forcing
Tk to fully initialize as an OS X gui process before destroying the
Tcl instance and creating another. (Original patch by Serhiy Storchaka)
2014-11-01 19:29:22 -07:00
Berker Peksag 8b63d3af9f Issue #22596: support.transient_internet() now also catches
ConnectionRefusedError exceptions wrapped by urllib.error.URLError.

This change should fix sporadic failures in test_urllib2net.
2014-10-25 05:42:30 +03:00
Zachary Ware f012ba42fe Issue #22002: Make full use of test discovery in test sub-packages.
Adds `load_package_tests` function to test.support, uses it in test_asyncio,
test_email, test_json, test_tools, test_importlib and all test_importlib
sub-packages to implement test discovery.
2014-07-23 12:00:29 -05:00
Victor Stinner 47ae763d28 Issue #19629: Add missing "import stat"
Sort also imports in support/__init__.py
2014-07-21 21:40:19 +02:00
Victor Stinner 67f8706521 Issue #19629: Fix support.rmtree(), use os.lstat() to check if the file is a
directory, not os.path.isdir()
2014-07-21 19:18:12 +02:00
Zachary Ware 66f2928479 Issue #18492: Allow all resources when tests are not run by regrtest.py.
This changeset also includes cleanup allowed by this behavior change.
2014-06-02 16:01:29 -05:00
Ned Deily 88b5b6ddf6 Issue #18604: Skip the Tk instantiation test on OS X because it can
cause GUI tests to segfault in Cocoa Tk when run under regrtest -j
(multiple threads running subprocesses).
2014-05-03 19:24:05 -07:00
Zachary Ware ceced6bfea Issue #18604: Consolidated checks for GUI availability.
test_support._is_gui_available is now defined the same way on every
platform, and now includes the Windows-specific check that had been in the
Windows version of _is_gui_available and the OSX-specific check that was
in tkinter.test.support.check_tk_availability.  Also, every platform
checks whether Tk can be instantiated (if the platform-specific checks
passed).
2014-05-02 10:51:07 -05:00
Victor Stinner 9a49c648ca Issue #20667: KqueueEventLoopTests.test_read_pty_output() hangs also on OpenBSD 5.5. 2014-02-18 09:13:47 +01:00
Victor Stinner 3bc3aaab13 Issue #20667: test_asyncio: Skip KqueueEventLoopTests.test_read_pty_output() on
OpenBSD older than 5.5
2014-02-18 01:30:03 +01:00
Serhiy Storchaka f28ba369dd Issue #20532: Tests which use _testcapi now are marked as CPython only. 2014-02-07 10:10:55 +02:00
Serhiy Storchaka 5cfc79deae Issue #20532: Tests which use _testcapi now are marked as CPython only. 2014-02-07 10:06:39 +02:00
Victor Stinner ed3b0bca3e Issue #18874: Implement the PEP 454 (tracemalloc) 2013-11-23 12:27:24 +01:00
Brett Cannon fe77f4ebb5 Issue #19718: Add a case-insensitive FS check to test.support to use
in test_pathlib.

Purposefully designed to work from a specified directory in case
multiple file systems are used on the system.
2013-11-22 16:14:10 -05:00
Gregory P. Smith 162307fa35 Fix test.support.bind_port() to not cause an error when Python was compiled
on a system with SO_REUSEPORT defined in the headers but run on a system
with an OS kernel that does not support that reasonably new socket option.
2013-11-17 22:19:32 +00:00
Gregory P. Smith b6e622d184 Fix test.support.bind_port() to not cause an error when Python was compiled
on a system with SO_REUSEPORT defined in the headers but run on a system
with an OS kernel that does not support that reasonably new socket option.
2013-11-17 22:21:02 +00:00
Giampaolo Rodola' 1bfa7ed3b0 test.support: considering the module is a mix of utilities unrelated with each other divide __all__ in sub-sections so that it can be used as a quick-reference doc 2013-11-12 23:08:27 +01:00
Nick Coghlan 624a74e4b7 Mitigate #19412: restore test skips for --without-doc-strings 2013-10-27 14:19:12 +10:00
Nick Coghlan 561eb5cbe4 Issue #19330: Handle the no-docstrings case in tests 2013-10-26 22:20:43 +10:00
Antoine Pitrou 77e904e6a6 Issue #18948: improve SuppressCoreFiles to include Windows crash popup suppression, and use it in more tests.
Patch by Valerie Lambert and Zachary Ware.
2013-10-08 23:04:32 +02:00
Nick Coghlan ff6382b40d Merge #18952 fix from 3.3 2013-09-08 12:49:53 +10:00
Nick Coghlan 0494c2ae7f Close #18952: correctly download test support data
When test.support was converted to a package, it started silently
skipping the tests which needed to download support data to run.

This change refactors the affected code, and also tidies up
test.support.findfile to remove the unused *here* parameter, document
the *subdir* parameter and rename the *filename* parameter to avoid
shadowing the file builtin and be consistent with the documentation.

The unexpected skips were noticed and reported by Zachary Ware
2013-09-08 11:40:34 +10:00
Antoine Pitrou 66ff01fede Remove old-school inheritance 2013-09-06 21:18:25 +02:00
Antoine Pitrou b0478b3f5f Issue #18623: Factor out the _SuppressCoreFiles context manager into test.support.
Patch by Valerie Lambert.
2013-09-06 20:50:00 +02:00
Charles-François Natali fcfb324e81 Use the recent support.HOSTv6 addition. 2013-08-31 14:40:49 +02:00
Charles-François Natali f25f80c839 Merge. 2013-08-29 19:27:17 +02:00
Charles-François Natali e33d5b0bc8 Merge. 2013-08-29 19:26:37 +02:00
Charles-François Natali 74b7408604 Issue #18643: Fix some test_socket failures due to large default socket buffer
sizes.
2013-08-29 19:02:23 +02:00
Charles-François Natali 5fd2642adb Issue #18643: Fix some test_socket failures due to large default socket buffer
sizes.
2013-08-29 19:01:40 +02:00
Victor Stinner d98af985d0 (Merge 3.3) Fix @requires_freebsd_version and @requires_linux_version
decorators of test.support, run the test if the platform matchs!
2013-08-28 12:34:16 +02:00
Victor Stinner 3b44a409de Fix @requires_freebsd_version and @requires_linux_version decorators of
test.support, run the test if the platform matchs!
2013-08-28 12:26:28 +02:00
Antoine Pitrou 1e440cf5a2 Issue #18792: Use "127.0.0.1" or "::1" instead of "localhost" as much as possible, since "localhost" goes through a DNS lookup under recent Windows versions. 2013-08-22 00:39:46 +02:00
Antoine Pitrou f6fbf56071 Issue #18792: Use "127.0.0.1" or "::1" instead of "localhost" as much as possible, since "localhost" goes through a DNS lookup under recent Windows versions. 2013-08-22 00:39:46 +02:00
Ezio Melotti e0c69161bc #18741: merge with 3.3. 2013-08-17 16:13:22 +03:00
Ezio Melotti b5bc353b88 #18741: fix more typos. Patch by Févry Thibault. 2013-08-17 16:11:40 +03:00
Antoine Pitrou 05eafa887b Make test.support.reap_threads() faster 2013-08-16 21:02:02 +02:00
Eli Bendersky 01ea326a8e Close #12645: Clarify and reformat the documentation of import_fresh_module 2013-08-11 15:43:30 -07:00
Eli Bendersky ba5517d4c0 Issue #12645: Clarify and reformat the documentation of import_fresh_module 2013-08-11 15:38:08 -07:00
Nick Coghlan cf67b2a891 Merge #15415 from 3.3 2013-07-28 22:25:25 +10:00
Nick Coghlan 5517596c04 Close #15415: Factor out temp dir helpers to test.support
Patch by Chris Jerdonek
2013-07-28 22:11:50 +10:00
Nick Coghlan 69e3bda310 Issue #15494: test.support is now a package rather than a module
Also including this change in 3.3 to help avoid spurious conflicts
between the two most active branches.

(Initial patch by Indra Talip)
2013-07-28 21:06:50 +10:00
Nick Coghlan fb15aa1e08 Close #15494: test.support is now a package rather than a module
Initial patch by Indra Talip
2013-07-28 20:56:19 +10:00