Commit Graph

27238 Commits

Author SHA1 Message Date
Victor Stinner 0cba38d207 bpo-30778: Skip test_bsddb3 on Windows XP (#2877)
* bpo-30778: Skip test_bsddb3 on Windows XP

* Fix if, don't skip Windows Vista
2017-07-26 17:55:52 +02:00
Victor Stinner b65cb8a356 bpo-31019: Fix multiprocessing.Process.is_alive() (#2875) (#2882)
multiprocessing.Process.is_alive() now removes the process from the
_children set if the process completed.

The change prevents leaking "dangling" processes.
(cherry picked from commit 2db64823c2)
2017-07-26 17:54:42 +02:00
Victor Stinner ec9a7127b8 [3.6] bpo-30595: Fix multiprocessing.Queue.get(timeout) (#2027) (#2881) (#2883)
* bpo-30595: Fix multiprocessing.Queue.get(timeout) (#2027)

multiprocessing.Queue.get() with a timeout now polls its reader in
non-blocking mode if it succeeded to aquire the lock but the acquire
took longer than the timeout.

Co-Authored-By: Grzegorz Grzywacz <grzgrzgrz3@gmail.com>
(cherry picked from commit 1b7863c3b6)

* bpo-30595: Increase test_queue_feeder_donot_stop_onexc() timeout (#2148)

_test_multiprocessing.test_queue_feeder_donot_stop_onexc() now uses a
timeout of 1 second on Queue.get(), instead of 0.1 second, for slow
buildbots.
(cherry picked from commit 8f6eeaf21c)

(cherry picked from commit e42339d3a0)
2017-07-26 17:52:36 +02:00
Dong-hee Na e5eae474c4 [2.7] bpo-30119: fix ftplib.FTP.putline() to throw an error for a illegal command (#1214) (#2894) 2017-07-26 17:50:36 +02:00
Victor Stinner 0fc940a09a test_bsddb3 tolerates smaller timeout on Windows (#2840)
bpo-30850: On Windows, test04_lock_timeout2() now tolerates 50 ms
whereas 100 ms is expected. The lock sometimes times out after only
58 ms. Windows clocks have a bad resolution and bad accuracy.
2017-07-24 13:01:59 +02:00
Victor Stinner 80ebc438ed bpo-30822: regrtest: fix -u extralargefile (#2788)
Fix also regrtest command line parser to allow passing -u
extralargefile to run test_zipfile64.
2017-07-21 02:12:14 +02:00
Ammar Askar a739000db5 [2.7] bpo-30883: Use pythontest.net instead of debian.org in test_urllib2net (GH-2755) 2017-07-19 07:07:49 +03:00
Serhiy Storchaka b6dae2e40d [2.7] bpo-30911: Add tests for bad boolean arguments for accelerated json (GH-2690) (#2694)
encoder and decoder..
(cherry picked from commit d3aaa2f149)
2017-07-13 12:03:18 +03:00
Victor Stinner f6d6480b93 [2.7] bpo-30855: Trying to fix test_use on Windows. (#2586)
* bpo-30855: Trying to fix test_use on Windows.

Avoid possible weird behavior of WideInt convertion.
"winfo id" always returns string hexadecimal representation.

(cherry picked from commit b9d672491d)

* bpo-30855: Trying to fix test_use on Windows.

(cherry picked from commit 29a2f7c6b3)
(subTest() removed since it was introduced in Python 3)
2017-07-06 10:22:50 +02:00
Mariatta af6c5474cc Fix trivial typo in json module docstring (GH-2274) (GH-2432)
(cherry picked from commit 76c567ee27)
2017-07-05 20:55:30 -07:00
Serhiy Storchaka 2b92cd3b16 bpo-30850: Use specialized assert methods in bsddb tests. (#2584)
This provides more information on test failures.
2017-07-05 14:09:36 +02:00
Victor Stinner 8767de2f77 bpo-30759: regrtest: list_cases() now unload modules (#2582)
list_cases() now unload modules, as the test runner does, to prevent
a failure in test_xpickle about test.pickletester loaded after
loading test_cpickle:

./python -m test --list-cases test_cpickle test_xpickle
2017-07-05 10:52:06 +02:00
Victor Stinner 668489a6d5 bpo-30759: Copy test_robotparser from master (#2546)
Copy Lib/test/test_robotparser.py from master to 2.7 and adapt it for
Python 2.7:

* Replace urllib.robotparser with robotparser
* Adjust HTTPServer import
* Replace io.StringIO with StringIO.StringIO
* Remove tests on crawl_delay() and request_rate() since these
  methods were added to Python 3
* Remove subTest()
* Add test_main() which explicitly lists all test cases

Patch based on the commit 4da0fd06ce
written by Berker Peksag.

Co-Authored-By: Berker Peksag <berker.peksag@gmail.com>
2017-07-05 10:00:33 +02:00
Victor Stinner 3050987d85 bpo-30843: regrtest fixes sys.path, restore test.bisect (#2567)
* Rename again Lib/test/bisectcmd.py to Lib/test/bisect.py
* regrtest now removes '' and Lib/test/ from sys.path
* Use absolute import in test_bisect
2017-07-05 09:16:47 +02:00
Victor Stinner 28b72baf3c bpo-30843: Rename Lib/test/bisect.py to Lib/test/bisectcmd.py (#2563)
Revert test_bisect.py change:
remove "from __future__ import absolute_import".
2017-07-04 11:45:04 +02:00
Victor Stinner 1fef0154d9 bpo-29796: test_weakref: Fix collect_in_thread() on Windows (#2553)
Sleep 1 ms instead of 0.1 ms to workaround a rounding issue on
Windows. On Windows, time.sleep(0.0001) sleeps 0 ms, so
collect_in_thread() calls gc.collect() in a loop and tests using this
thread takes too long. Sleep 1 ms so time.sleep() sleeps 15.6 ms on
Windows.
2017-07-04 11:36:16 +02:00
Victor Stinner 1e4fcb3edd regrtest: fix --list-cases --verbose (#2547)
Write header and "Using seed ..." after checking for --list-cases and
--list-tests.
2017-07-03 22:18:28 +02:00
Serhiy Storchaka c51a8e9072 [2.7] Rename test_ file that is really a support file to remove test_ prefix. (#2548)
I thought I had run the full test suite before the last checkin, but
obviously I didn't.  test_multibytecodec_support.py isn't really a test file,
it is a support file that contains a base test class.  Rename it to
multibytecodec_support so that regrtest test discovery doesn't think it is a
test file that should be run..
(cherry picked from commit 75d9aca97a)
2017-07-03 22:01:57 +02:00
Victor Stinner d7955b8196 [2.7] bpo-29512, bpo-30764: Backport regrtest enhancements from 3.5 to 2.7 (#2541)
* bpo-29512, bpo-30764: Backport regrtest enhancements from 3.5 to 2.7

* bpo-29512: Add test.bisect, bisect failing tests (#2452)

Add a new "python3 -m test.bisect" tool to bisect failing tests.

It can be used to find which test method(s) leak references, leak
files, etc.

* bpo-30764: Fix regrtest --fail-env-changed --forever (#2536) (#2539)

--forever now stops if a fail changes the environment.

* Fix test_bisect: use absolute import
2017-07-03 15:07:53 +02:00
Victor Stinner fd93f37f0d bpo-30448: Fix support.SuppressCrashReport on macOS (#2515)
Add missing "import subprocess".
2017-07-01 01:01:28 +02:00
Antoine Pitrou a45a99b47f [2.7] bpo-30807: signal.setitimer() may disable the timer by mistake (GH-2493) (#2499)
* bpo-30807: signal.setitimer() may disable the timer by mistake

* Add NEWS blurb.
(cherry picked from commit 729780a810)
2017-06-30 10:54:54 +02:00
Antoine Pitrou 12536bd261 [2.7] Clear potential ref cycle between Process and Process target (GH-2470) (#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 79d37ae979)
2017-06-28 13:48:38 +02:00
Victor Stinner fea98bfcff [2.7] bpo-30523, bpo-30764, bpo-30776: Sync regrtest from master (#2444)
* 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 ace56d5836)

(cherry picked from commit 36946c06a3)

* 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 63f54c6893)
(cherry picked from commit 1f33857a36)

* 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 48b5c422ff)

(cherry picked from commit e0f8b43a46)
2017-06-27 16:56:43 +02:00
Victor Stinner 2d775589d9 bpo-30705: Fix test_regrtest.test_crashed() (#2439)
* 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().
2017-06-27 15:37:19 +02:00
Victor Stinner 95a91df036 bpo-30764: Windows support.SuppressCrashReport (#2423)
* 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.
2017-06-27 14:31:40 +02:00
Victor Stinner 2097b9e0ef [2.7] bpo-30764: test_subprocess uses SuppressCrashReport (#2405) (#2412)
* 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 cdee3f14f7)
2017-06-27 00:00:51 +02:00
Serhiy Storchaka 787826c931 [2.7] bpo-30746: Prohibited the '=' character in environment variable names (GH-2382) (#2393)
in `os.putenv()` and `os.spawn*()`..
(cherry picked from commit 77703942c5)
2017-06-25 09:50:00 +03:00
Serhiy Storchaka 9dda2caca8 [2.7] bpo-30730: Prevent environment variables injection in subprocess on Windows. (GH-2325) (#2372)
Prevent passing other invalid environment variables and command arguments..
(cherry picked from commit d174d24a5d)
2017-06-24 11:49:00 +03:00
Serhiy Storchaka 7709b4d57b [2.7] bpo-30727: Fix a race condition in test_threading. (GH-2334). (#2353)
(cherry picked from commit 32cb968a2e)
2017-06-23 14:13:39 +03:00
Victor Stinner da6d305b6f bpo-8799: Reduce timing sensitivity of condition test by explicitly (#2320)
delaying the main thread so that it doesn't race ahead of the workers.

(cherry picked from commit 020af2a2bc)
2017-06-22 02:09:40 +02:00
Victor Stinner d4324baca4 bpo-30500: urllib: Simplify splithost by calling into urlparse. (#1849) (#2294)
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 90e01e50ef)
2017-06-20 16:20:36 +02:00
Victor Stinner 24c2c20873 bpo-30540, bpo-30523: Add --matchfile and --list-cases options to regrtest (#2249)
[2.7] bpo-30540, bpo-30523: Add --matchfile and --list-cases options to regrtest
2017-06-16 17:30:03 +02:00
Victor Stinner 8bb0863e02 bpo-30675: Fix refleak hunting in regrtest (#2227)
regrtest now warms up caches: create explicitly all internal
singletons which are created on demand to prevent false positives
when checking for reference leaks.
2017-06-16 12:14:09 +02:00
Antoine Pitrou d09f1674d7 [2.7] bpo-24484: Avoid race condition in multiprocessing cleanup (GH-2159) (#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 1eb6c0074d)
2017-06-13 17:52:29 +02:00
Nick Coghlan a51f12f154 [2.7] bpo-29514: Check magic number for bugfix releases
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.
2017-06-13 20:58:48 +10:00
Serhiy Storchaka 0cc43df05e [2.7] bpo-28994: Fixed errors handling in atexit._run_exitfuncs(). (GH-2034) (#2123)
The traceback no longer displayed for SystemExit raised in a callback registered by atexit..
(cherry picked from commit 3fd54d4a7e)
2017-06-12 09:10:53 +03:00
Zachary Ware 5fe8ac69f9 [2.7] bpo-27425: Be more explicit in .gitattributes (GH-840) (GH-2086)
Also updates checked-in line endings in several files.
2017-06-11 14:19:39 -05:00
Victor Stinner e5bdad2201 bpo-30418: Popen.communicate() always ignore EINVAL (#2002) (#2006)
On Windows, subprocess.Popen.communicate() now also ignore EINVAL
on stdin.write() if the child process is still running but closed the
pipe.
(cherry picked from commit d52aa31378)
2017-06-08 18:34:30 +02:00
Alex Gaynor e14af32cc6 Simplify code in warnings modules (#1957)
Metaprogramming a list of attributes was excessive, and made the code less readable and slower.

Backport of 5de3a64179
2017-06-05 09:13:50 -04:00
Zachary Ware 87edc5e5e0 Skip UNC tests on AppVeyor in case of ENOENT (GH-1950) 2017-06-04 17:45:02 -05:00
Xiang Zhang 3ef3bcbe38 bpo-30378: Fix the problem that SysLogHandler can't handle IPv6 addresses (#1904) (#1676) 2017-06-01 22:22:18 +08:00
Mariatta 1626a479e2 [2.7] bpo-29960 _random.Random corrupted on exception in setstate(). … (#1289)
(cherry picked from commit 9616a82e78)
2017-05-27 07:19:55 -07:00
Serhiy Storchaka 96f5020597 [2.7] bpo-30310: tkFont now supports unicode options (e.g. font family). (#1567) 2017-05-26 08:15:51 +03:00
Antoine Pitrou bdd964710d [2.7] bpo-30414: multiprocessing.Queue._feed do not break from main loop on 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 bc50f03db4)
2017-05-25 17:53:04 +02:00
Stéphane Wirtel 779e7c933e bpo-30394: Fix a socket leak in smtplib.SMTP.__init__() (#1700) (#1788) 2017-05-25 02:24:27 +08:00
Vijay Kumar f31f225468 Fix spelling mistakes in tkinter.py (#1754)
Ran the docstrings through spell checker, and fixed spelling issues.
2017-05-23 09:16:27 +03:00
Xiang Zhang 6e1b832a6c bpo-30003: Fix handling escape characters in HZ codec (#1720) (#1556) 2017-05-23 01:04:27 +08:00
Serhiy Storchaka 2b67c7aae7 [2.7] bpo-30415: Add new tests for the fnmatch module. (GH-1684). (#1696)
(cherry picked from commit 817554715b)
2017-05-21 10:37:43 +03:00
Sean McCully cef8b1741c bpo-30409: locale.getpreferredencoding doesn't return result (#1672) 2017-05-20 18:44:02 -07:00
Serhiy Storchaka e6a0b59829 [2.7] bpo-27945: Fixed various segfaults with dict. (GH-1657) (#1681)
Based on patches by Duane Griffin and Tim Mitchell.
(cherry picked from commit 753bca3934)
2017-05-20 20:05:27 +03:00