summaryrefslogtreecommitdiffstats
path: root/Lib/test
Commit message (Collapse)AuthorAgeFilesLines
...
* [2.7] Clear potential ref cycle between Process and Process target (GH-2470) ↵Antoine Pitrou2017-06-281-0/+18
| | | | | | | | | | | (#2473) * Clear potential ref cycle between Process and Process target Besides Process.join() not being called, this was an indirect cause of bpo-30775. The threading module already does this. * Add issue reference. (cherry picked from commit 79d37ae979a65ada0b2ac820279ccc3b1cd41ba6)
* [2.7] bpo-30523, bpo-30764, bpo-30776: Sync regrtest from master (#2444)Victor Stinner2017-06-273-42/+148
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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. (cherry picked from commit ace56d583664f855d89d1219ece7c21c2fddcf30) (cherry picked from commit 36946c06a3bdb1104c53f0fe535086572ffbdd9e) * bpo-30764: regrtest: add --fail-env-changed option (#2402) * bpo-30764: regrtest: change exit code on failure * Exit code 2 if failed tests ("bad") * Exit code 3 if interrupted * bpo-30764: regrtest: add --fail-env-changed option If the option is set, mark a test as failed if it alters the environment, for example if it creates a file without removing it. (cherry picked from commit 63f54c68936d648c70ca411661e4208329edcf26) (cherry picked from commit 1f33857a3677de84bdc6d80c39f577eb081ed85d) * bpo-30776: reduce regrtest -R false positives (#2422) * Change the regrtest --huntrleaks checker to decide if a test file leaks or not. Require that each run leaks at least 1 reference. * Warmup runs are now completely ignored: ignored in the checker test and not used anymore to compute the sum. * Add an unit test for a reference leak. Example of reference differences previously considered a failure (leak) and now considered as success (success, no leak): [3, 0, 0] [0, 1, 0] [8, -8, 1] (cherry picked from commit 48b5c422ffb03affb00c184b9a99e5537be92732) (cherry picked from commit e0f8b43a46850aa5e5992465cab684496f102fe5)
* bpo-30705: Fix test_regrtest.test_crashed() (#2439)Victor Stinner2017-06-273-5/+18
| | | | | | | * Add test.support._crash_python() which triggers a crash but uses test.support.SuppressCrashReport() to prevent a crash report from popping up. * Modify test_child_terminated_in_stopped_state() of test_subprocess and test_crashed() of test_regrtest to use _crash_python().
* bpo-30764: Windows support.SuppressCrashReport (#2423)Victor Stinner2017-06-271-13/+39
| | | | | | * Add Windows support to test.support.SuppressCrashReport: call SetErrorMode() and CrtSetReportMode(). * _testcapi: add CrtSetReportMode() and CrtSetReportFile() functions and CRT_xxx and CRTDBG_xxx constants needed by SuppressCrashReport.
* [2.7] bpo-30764: test_subprocess uses SuppressCrashReport (#2405) (#2412)Victor Stinner2017-06-262-27/+103
| | | | | | | | | | | | | | | * bpo-30764: Backport support.SuppressCrashReport Backport test.support.SuppressCrashReport context-manager from master. Drop the Windows implementation since it depends on msvcrt.CrtSetReportMode() which isn't available on Python 2.7. * bpo-30764: test_subprocess uses SuppressCrashReport (#2405) bpo-30764, bpo-29335: test_child_terminated_in_stopped_state() of test_subprocess now uses support.SuppressCrashReport() to prevent the creation of a core dump on FreeBSD. (cherry picked from commit cdee3f14f7f4c995e7eedb0bf6a67e260c739f7d)
* [2.7] bpo-30746: Prohibited the '=' character in environment variable names ↵Serhiy Storchaka2017-06-252-3/+90
| | | | | | | (GH-2382) (#2393) in `os.putenv()` and `os.spawn*()`.. (cherry picked from commit 77703942c5997dff00c48f10df1b29b11645624c)
* [2.7] bpo-30730: Prevent environment variables injection in subprocess on ↵Serhiy Storchaka2017-06-241-0/+40
| | | | | | Windows. (GH-2325) (#2372) Prevent passing other invalid environment variables and command arguments.. (cherry picked from commit d174d24a5d37d1516b885dc7c82f71ecd5930700)
* [2.7] bpo-30727: Fix a race condition in test_threading. (GH-2334). (#2353)Serhiy Storchaka2017-06-231-5/+14
| | | | (cherry picked from commit 32cb968a2edd482891c33b6f2ebae10f1d305424)
* bpo-8799: Reduce timing sensitivity of condition test by explicitly (#2320)Victor Stinner2017-06-221-0/+15
| | | | | delaying the main thread so that it doesn't race ahead of the workers. (cherry picked from commit 020af2a2bc4708215360a3793b5a1790e15d05dd)
* bpo-30500: urllib: Simplify splithost by calling into urlparse. (#1849) (#2294)Victor Stinner2017-06-201-0/+20
| | | | | | | | | The current regex based splitting produces a wrong result. For example:: http://abc#@def Web browsers parse that URL as ``http://abc/#@def``, that is, the host is ``abc``, the path is ``/``, and the fragment is ``#@def``. (cherry picked from commit 90e01e50ef8a9e6c91f30d965563c378a4ad26de)
* bpo-30540, bpo-30523: Add --matchfile and --list-cases options to regrtest ↵Victor Stinner2017-06-163-12/+141
| | | | | (#2249) [2.7] bpo-30540, bpo-30523: Add --matchfile and --list-cases options to regrtest
* bpo-30675: Fix refleak hunting in regrtest (#2227)Victor Stinner2017-06-161-0/+17
| | | | | regrtest now warms up caches: create explicitly all internal singletons which are created on demand to prevent false positives when checking for reference leaks.
* [2.7] bpo-24484: Avoid race condition in multiprocessing cleanup (GH-2159) ↵Antoine Pitrou2017-06-131-0/+61
| | | | | | | | | | | | | (#2168) * bpo-24484: Avoid race condition in multiprocessing cleanup The finalizer registry can be mutated while inspected by multiprocessing at process exit. * Use test.support.start_threads() * Add Misc/NEWS. (cherry picked from commit 1eb6c0074d17f4fd425cacfdda893d65f5f77f0a)
* [2.7] bpo-29514: Check magic number for bugfix releasesNick Coghlan2017-06-131-0/+58
| | | | | | | | | | | | Add a test to check the current MAGIC_NUMBER against the expected number for the release if the current release is at candidate or final level. On test failure, describe to the developer the procedure for changing the magic number. This ensures that pre-merge CI will automatically pick up on magic number changes in maintenance releases (and explain why those are problematic), rather than relying on all core developers to be aware of the implications of such changes.
* [2.7] bpo-28994: Fixed errors handling in atexit._run_exitfuncs(). (GH-2034) ↵Serhiy Storchaka2017-06-121-2/+14
| | | | | | (#2123) The traceback no longer displayed for SystemExit raised in a callback registered by atexit.. (cherry picked from commit 3fd54d4a7e604067e2bc0f8cfd58bdbdc09fa7f4)
* Skip UNC tests on AppVeyor in case of ENOENT (GH-1950)Zachary Ware2017-06-042-2/+2
|
* [2.7] bpo-29960 _random.Random corrupted on exception in setstate(). … (#1289)Mariatta2017-05-271-0/+5
| | | (cherry picked from commit 9616a82e7802241a4b74cf7ae38d43c37bf66e48)
* [2.7] bpo-30414: multiprocessing.Queue._feed do not break from main loop on ↵Antoine Pitrou2017-05-251-0/+15
| | | | | | | | | | | | | | | | | | exc (GH-1683) (#1817) * bpo-30414: multiprocesing.Queue._feed do not break from main loop on exc Queue background running thread was not handling exceptions correctly. Any exception occurred inside thread (putting unpickable object) cause feeder to finish running. After that every message put into queue is silently ignored. * bpo-30414: multiprocesing.Queue._feed do not break from main loop on exc Queue background running thread was not handling exceptions correctly. Any exception occurred inside thread (putting unpickable object) cause feeder to finish running. After that every message put into queue is silently ignored.. (cherry picked from commit bc50f03db4f58c869b78e98468e374d7e61f1227)
* bpo-30003: Fix handling escape characters in HZ codec (#1720) (#1556)Xiang Zhang2017-05-221-0/+4
|
* [2.7] bpo-30415: Add new tests for the fnmatch module. (GH-1684). (#1696)Serhiy Storchaka2017-05-211-11/+104
| | | (cherry picked from commit 817554715b5578b0bac5c35e6ec9a1abd8649e53)
* [2.7] bpo-27945: Fixed various segfaults with dict. (GH-1657) (#1681)Serhiy Storchaka2017-05-201-0/+91
| | | | | Based on patches by Duane Griffin and Tim Mitchell. (cherry picked from commit 753bca3934a7618a4fa96e107ad1c5c18633a683)
* [2.7] bpo-25794: Fix `type.__setattr__()` for non-interned or unicode ↵Serhiy Storchaka2017-05-201-0/+43
| | | | | | attribute names. (GH-1652) (#1675) Based on patch by Eryk Sun. (cherry picked from commit d896985bb2de49046f9b6879e906d1e4db255e23)
* [2.7] bpo-30363: Backport warnings in the re module. (#1577)Serhiy Storchaka2017-05-181-14/+78
| | | | | | Running Python with the -3 option now warns about regular expression syntax that is invalid or has different semantic in Python 3 or will change the behavior in future Python versions.
* bpo-30365: Backport warnings and fix bugs in ElementTree. (#1581)Serhiy Storchaka2017-05-171-49/+58
| | | | | | | | | | | | | | | | | | Running Python with the -3 option now emits deprecation warnings for getchildren() and getiterator() methods of the Element class in the xml.etree.cElementTree module and when pass the html argument to xml.etree.ElementTree.XMLParser(). Fixed a deprecation warning about the doctype() method of the xml.etree.ElementTree.XMLParser class. Now it is emitted only when define the doctype() method in the subclass of XMLParser. Fixed a bug in the test_bug_200708_close test method. An EchoTarget instance was incorrectly passed to XMLParser() as the html argument and silently ignored. Tests no longer failed when use the -m option for running only selected test methods. Checking warnings now is more specific, warnings are expected only when use deprecated features.
* bpo-30357 each test in test_thread waits until all spawned threads finish ↵grzgrzgrz32017-05-151-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | (#1583) * bpo-30357 each test in test_thread waits until all spawn threads finish * bpo-30357 each test in test_thread waits until all spawn threads finish * bpo-30357: test_thread now uses threading_cleanup() (#1592) test_thread: setUp() now uses support.threading_setup() and support.threading_cleanup() to wait until threads complete to avoid random side effects on following tests. Co-Authored-By: Victor Stinner <victor.stinner@gmail.com> * bpo-30357: test_thread now uses threading_cleanup() (#1592) test_thread: setUp() now uses support.threading_setup() and support.threading_cleanup() to wait until threads complete to avoid random side effects on following tests. Co-Authored-By: Victor Stinner <victor.stinner@gmail.com>
* bpo-11790: Fix sporadic failures in ↵Victor Stinner2017-05-151-1/+7
| | | | | test_multiprocessing.WithProcessesTestCondition. (#1591) (cherry picked from commit f25a8de845d20349a265442eb0f3dcd71d0d7ac5)
* [2.7] bpo-30366: Backport tests for test.support. (#1582)Serhiy Storchaka2017-05-152-35/+452
| | | | | | | Also backport new functions temp_dir() and python_is_optimized(). temp_cwd() now accepts None as a name (means using tempfile.mkdtemp). check_syntax_error() now accepts arguments lineno and offset. Use more specific error messages in get_attribute().
* bpo-30342: Fix sysconfig.is_python_build() on VS9.0 (#1544)Victor Stinner2017-05-121-0/+2
| | | | Fix sysconfig.is_python_build() if Python is built with Visual Studio 2008 (VS 9.0).
* [2.7] bpo-30283: regrtest: backport test_slow_interrupted() and ↵Victor Stinner2017-05-112-25/+75
| | | | | | | | | | | | | | | | | | | | | | | | | test_coverage() (#1541) * bpo-30283: regrtest: backport test_coverage() * Add --coverage option, the option was already described in the doc * When coverage is used, regrtest now pass all options to runtest() and calls also accumulate_result() (as done when coverage is not used). * bpo-25260: Fix coverage on Windows: remove the list of ignored directories. * bpo-30283: regrtest: backport test_slow_interrupted() * Fix regrtest to report interrupted tests as omitted rather than failed. * bpo-25260: Fix coverage on Windows: remove the list of ignored directories. * bpo-30283: Fix test_regrtest on Visual Studio 2008 Skip Tools\buildbot\test.bat and PCbuild\rt.bat if Python was not compiled in PCbuild (but compiled in PC\VS9.0\ for example).
* bpo-15526: test_startfile changes the cwd (#1537)Victor Stinner2017-05-101-12/+15
| | | | | | | | | | | | Try to fix test_startfile's inability to clean up after itself in time. Patch by Jeremy Kloth. Fix the following support.rmtree() error while trying to remove the temporary working directory used by Python tests: WindowsError: [Error 32] The process cannot access the file because it is being used by another process: ... Original commit: 8a53dbeb7a9d0ae3e446f36e56cf9acfabe443c1
* bpo-30283: Backport regrtest features from master to 2.7 (#1516)Victor Stinner2017-05-092-57/+206
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * regrtest: add --slowest alias to --slow * make buildbottest: add --slowest option * regrtest: add "- " prefix to --slowest output * regrtest: Fix an outdated comment * regrtest: replace PermissionError Replace PermissionError with OSError and check on exc.errno. PermissionError was added to Python 3.3. * regrtest: add -3 -tt options to run Python scripts * regrtest: backport --list-tests option * regrtest: backport "Tests result: xxx" summary * regrtest: backport total duration * regrtest: add timestamp to the progress * regrtest: describe previous test state * Add the state of the test: passed, failed, etc. * If a test took longer than 30 seconds, log its execution time * regrtest: -jN logs running workers * regrtest: mention if tests are run in parallel * regrtest: parallel mode is more verbose during wait Display running tests every 30 seconds if no test completed in the meanwhile. * test_regrtest: fix typo in SubprocessRun
* [2.7] bpo-30283: Backport test_regrtest from master to 2.7 (#1513)Victor Stinner2017-05-092-22/+473
| | | | | | | | | | * bpo-30283: regrtest: add --testdir option * bpo-30283: Backport _testcapi.raise_signal() Function used by test_regrtest to simulate an interrupted unit test. * bpo-30283: Backport test_regrtest from master
* Fix SyntaxWarning on importing test_inspect (#1512)Victor Stinner2017-05-091-5/+11
| | | | | | | | | Fix the following warning when test_inspect.py is compiled to test_inspect.pyc: test_inspect.py:505: SyntaxWarning: tuple parameter unpacking has been removed in 3.x def spam_deref(a, b, c, d=3, (e, (f,))=(4, (5,)), *g, **h): Replace also test.test_support import with test.support.
* bpo-29990: Fix range checking in GB18030 decoder (#1509)Xiang Zhang2017-05-091-0/+6
|
* bpo-30258: Fix handling of child error in regrtest (#1477)Victor Stinner2017-05-051-8/+8
| | | Don't stop the worker thread if a child failed.
* bpo-30265: support.unlink() don't catch any OSError (#1456)Victor Stinner2017-05-051-2/+3
| | | | support.unlink() now only ignores ENOENT and ENOTDIR, instead of ignoring any OSError exception.
* bpo-30264: ExpatParser now closes the source (#1476)Victor Stinner2017-05-051-1/+17
| | | | | | | ExpatParser.parse() of xml.sax.xmlreader now closes the source: close the file object or the urllib object if source is a string (not an open file-like object). Add test_parse_close_source() unit test.
* Relax test timing (bpo-29861) to avoid sporadic failures (#1120) (#1472)Victor Stinner2017-05-051-0/+1
| | | (cherry picked from commit 685cdb9acc3fca04a9897d88b89771ddfd50e772)
* bpo-30108: Fix test_site setUpModule() (#1460)Victor Stinner2017-05-041-3/+7
| | | | Oops, I forgot that PermissionError was introduced in Python 3.3! Replace PermissionError with OSError and check on errno.
* bpo-30108: Restore sys.path in test_site (#1197) (#1459)Victor Stinner2017-05-041-8/+21
| | | | | | | Add setUpModule() and tearDownModule() functions to test_site to save/restore sys.path at the module level to prevent warning if the user site directory is created, since site.addsitedir() modifies sys.path. (cherry picked from commit b85c136903c6d2368162f7c4a58f258c9c69ead0)
* Fix test_ftplib warning if IPv6 is not available (#1457)Victor Stinner2017-05-041-6/+12
| | | | | | | | DummyFTPServer now calls del_channel() on bind() error to prevent the following warning in TestIPv6Environment.setUpClass(): Warning -- asyncore.socket_map was modified by test_ftplib Before: {} After: {3: <test.test_ftplib.DummyFTPServer 127.0.0.1:0 at ...>}
* [2.7] bpo-30236: Backported regrtest options -m and -G. (#1394)Serhiy Storchaka2017-05-032-6/+46
|
* bpo-30258: regrtest handles child process crash (#1431)Victor Stinner2017-05-031-8/+27
| | | | | | | | | | | Backport the CHILD_ERROR status from master: a test is considered as failed if a worker process running a test exited with a code different than zero. Change also the output: write stdout and stderr of the child process after the test name, instead of writing it before. accumulate_result(): don't use time of CHILD_ERROR or INTERRUPTED results.
* regrtest: always show before/after of modified env (#1407) (#1409)Victor Stinner2017-05-031-4/+3
| | | | | | | | | | Buildbots don't run tests with -vv and so only log "xxx was modified by test_xxx" which is not enough to debug such random issue. In many cases, I'm unable to reproduce the warning and so unable to fix it. Always logging the value before and value after should help to debug such warning on buildbots. (cherry picked from commit ec4b17239d899550be4ee6104b61751bb3c70382) (cherry picked from commit 22982350235f8c5821b71661a5616423e1c7fcc0)
* bpo-30199: test_ssl closes all asyncore channels (#1381) (#1408)Victor Stinner2017-05-031-0/+2
| | | | | | | | | | | | | AsyncoreEchoServer of test_ssl now calls asyncore.close_all(ignore_all=True) to ensure that asyncore.socket_map is cleared once the test completes, even if ConnectionHandler was not correctly unregistered. Fix the following warning: Warning -- asyncore.socket_map was modified by test_ssl Before: {} After: {6: <test.test_ssl.AsyncoreEchoServer.EchoServer.ConnectionHandler>} (cherry picked from commit 1dae7450c68bad498e57800387b24cb103c461fa)
* bpo-30223: Add global in regrtest main_in_temp_cwd (#1399)Victor Stinner2017-05-021-0/+2
|
* [2.7] bpo-30223: Fix test_xpickle for Python 2.4. (#1395)Serhiy Storchaka2017-05-021-3/+1
|
* [2.7] bpo-30223: Add Lib/test/__main__.py. (#1373)Serhiy Storchaka2017-05-024-10/+21
| | | | | | To unify running tests in Python 2.7 and Python 3, the test package can be run as a script. This is equivalent to running the test.regrtest module as a script.
* bpo-30207: Rename test.test_support to test.support. (#1353)Serhiy Storchaka2017-04-306-1929/+1939
| | | | | | | | To simplify backports from Python 3, the test.test_support module was converted into a package and renamed to test.support. The test.script_helper module was moved into the test.support package. Names test.test_support and test.script_helper are left as aliases to test.support and test.support.script_helper.
* [2.7] bpo-30197: Enhance swap_attr() and backport swap_item() in ↵Serhiy Storchaka2017-04-282-5/+39
| | | | | | test.test_support. (#1341) (#1347) (cherry picked from commit d1a1def7bf221b04dcf3fc3a67aa19aa2f622f83)