39060 Commits

Author SHA1 Message Date
Victor Stinner
de1850bb03 [3.5] bpo-30523, bpo-30764, bpo-30776: Sync regrtest from master (#2442)
* 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)

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

* 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)
2017-06-27 16:35:18 +02:00
Victor Stinner
849b062a82 bpo-30764: test_subprocess uses SuppressCrashReport (#2405) (#2411)
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-26 18:05:21 +02:00
Serhiy Storchaka
99e9eb6111 [3.5] bpo-30746: Prohibited the '=' character in environment variable names (GH-2382) (#2392)
in `os.putenv()` and `os.spawn*()`..
(cherry picked from commit 77703942c5)
2017-06-25 09:49:40 +03:00
Mariatta
3e8d6f5643 [3.5] Fix a typo in a comment in coroutines.py (GH-2267) (GH-2371)
defiend -> defined
(cherry picked from commit cab469245d)
2017-06-23 22:50:31 -07:00
Brett Cannon
599ff020b3 [3.5] bpo-30645: don't append to an inner loop path in imp.load_package() (GH-2268) (GH-2365)
Bug didn't manifest itself when importing a module with source as .py files are always the first on the search path. The issue only showed up in bytecode-only packages where the calculated file path would be ``__init__.py/__init__.pyc``.

Patch by Alexandru Ardelean.
(cherry picked from commit c38e32a100)
2017-06-23 11:39:53 -07:00
Serhiy Storchaka
a7c0264735 [3.5] bpo-30730: Prevent environment variables injection in subprocess on Windows. (GH-2325) (#2361)
Prevent passing other invalid environment variables and command arguments..
(cherry picked from commit d174d24a5d)
2017-06-23 20:27:02 +03:00
Serhiy Storchaka
e2aec8e691 [3.5] bpo-30727: Fix a race condition in test_threading. (GH-2334) (#2352)
(cherry picked from commit 32cb968)
2017-06-23 13:52:22 +03:00
Serhiy Storchaka
29c89d00bf [3.5] bpo-29755: Fixed the lgettext() family of functions in the gettext module. (GH-2266) (#2298)
They now always return bytes.

Updated the gettext documentation.
(cherry picked from commit 26cb465)
2017-06-20 18:06:45 +03:00
Victor Stinner
4899d847ed bpo-30500: urllib: Simplify splithost by calling into urlparse. (#1849) (#2290)
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 15:33:35 +02:00
Mariatta
070ba85a8f [3.5] bpo-29887: Test normalization now fails if download fails (GH-905) (#2272)
* [3.5] bpo-29887: Test normalization now fails if download fails (GH-905)

* test_normalization fails if download fails

bpo-29887. The test is still skipped if "-u urlfetch" option is not
passed to regrtest (python3 -m test -u urlfetch test_normalization).

* Fix ResourceWarning in test_normalization

bpo-29887: Fix ResourceWarning in test_normalization if tests are
interrupted by CTRL+c.
(cherry picked from commit 722a3af092)

* bpo-29887: test_normalization handles PermissionError (#1196)

Skip test_normalization.test_main() if download raises a permission
error.
(cherry picked from commit d13d54748d)

* no f-strings :(
2017-06-20 08:31:11 +02:00
Victor Stinner
a601fcca3b [3.5] bpo-30383: Backport regrtest and test_regrtest enhancements from master to 3.5 (#2279)
* bpo-30383: regrtest: prepend testdir to sys.path

* bpo-30383: Backport test_regrtest

* regrtest: rename --slow option to --slowest

The old --slow syntax is still accepted.

* regrtest: add a single oneliner summary

Example: "Tests result: SUCCESS"

* test_regrtest: add test_coverage()

regrtest now also displays the number of successful tests when
coverage is used.

* test_regrtest: add test_crashed()

Handle correctly crashing test: account the crash has a failed test,
but continue to run other tests.

* regrtest: backport --list-tests feature

* regrtest: backport --fromfile enhancements

* regrtest: backport displaying progress enhancements

* test_regrtest: backport test_randseed()

* regrtest: Fix --coverage on Windows

Don't ignore any directory anymore. Change backported from master.
2017-06-19 18:33:21 +02:00
Victor Stinner
46e299c153 [3.5] bpo-30540, bpo-30523: Add --matchfile and --list-cases options to regrtest (#2250)
* bpo-30540: regrtest: add --matchfile option

* 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_access()
of the FileTests class of test_os:

$ ./python -m test -v -m test.test_os.FileTests.test_access test_os

* bpo-30523: regrtest: Add --list-cases option

* Add --list-cases option to regrtest
* Add get_abs_module() function, use it in list_cases()
* Add ns mandatory positional argument to runtest()
  and runtest_inner()
* Add file optional parameter to printlist()

Co-Authored-By: Louie Lu <git@louie.lu>
2017-06-16 18:04:38 +02:00
Mariatta
820b71464c [email] bpo-29478: Fix passing max_line_length=None from Compat32 policy (GH-595) (GH-2234)
If max_line_length=None is specified while using the Compat32 policy,
it is no longer ignored..
(cherry picked from commit b459f74826)
2017-06-15 19:38:12 -07:00
Victor Stinner
3dc573c8d1 Fix ref cycles in TestCase.assertRaises() (#193) (#2228)
bpo-23890: unittest.TestCase.assertRaises() now manually breaks a
reference cycle to not keep objects alive longer than expected.
(cherry picked from commit bbd3cf8f1e)
2017-06-16 00:51:24 +02:00
Victor Stinner
33cf0c4cd6 bpo-30675: Fix multiprocessing code in regrtest (#2220)
* Rewrite code to pass slaveargs from the master process to worker
  processes: reuse the same code of the Python master branch
* Move code to initialize tests in a new setup_tests() function,
  similar change was done in the master branch
* In a worker process, call setup_tests() with the namespace built
  from slaveargs to initialize correctly tests

Before this change, warm_caches() was not called in worker processes
because the setup was done before rebuilding the namespace from
slaveargs. As a consequence, the huntrleaks feature was unstable. For
example, test_zipfile reported randomly false positive on reference
leaks.
2017-06-16 00:08:39 +02:00
Dong-hee Na
fb0825c278 bpo-30149: Fix partialmethod without explicit self parameter (#1308) (#1663) 2017-06-15 17:42:01 +03:00
Serhiy Storchaka
c5a6fb654a [3.5] bpo-29931 fix __lt__ check in ipaddress.ip_interface for both v4 and v6. (GH-879) (#2218)
the original logic was just comparing the network address
but this is wrong because if the network address is equal then
we need to compare the ip address for breaking the tie

add more ip_interface comparison tests.
(cherry picked from commit 7bd8d3e794)
2017-06-15 17:16:55 +03:00
Victor Stinner
7895a0585b bpo-30231: Remove skipped test_imaplib tests (#1419) (#2193)
The public cyrus.andrew.cmu.edu IMAP server (port 993) doesn't accept
TLS connection using our self-signed x509 certificate. Remove the two
tests which are already skipped.
2017-06-14 22:43:02 +02:00
Antoine Pitrou
a0ecaab006 [3.5] bpo-24484: Avoid race condition in multiprocessing cleanup (GH-2159) (#2167)
* 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:54:10 +02:00
Nick Coghlan
d071a20f13 [3.5] bpo-29514: Check magic number for bugfix releases (#2158)
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:32:24 +10:00
Serhiy Storchaka
7d8c1ebd86 [3.5] bpo-28994: Fixed errors handling in atexit._run_exitfuncs(). (GH-2034) (#2122)
The traceback no longer displayed for SystemExit raised in a callback registered by atexit.
(cherry picked from commit 3fd54d4a7e)
2017-06-12 09:02:33 +03:00
Zachary Ware
80bdbf6f49 [3.5] Use Travis to make sure all generated files are up to date (GH-2080) (GH-2093)
(cherry picked from commit 0afbabe245)

Also fixes some line endings missed in GH-840 backport.
2017-06-11 11:32:45 -05:00
Yury Selivanov
4e9dfe214d Revert "[3.5] bpo-29406: asyncio SSL contexts leak sockets after calling close with certain servers (GH-409) (#2063)" (#2113)
This reverts commit 1395c58ef7.
2017-06-11 16:46:53 +02:00
Yury Selivanov
d24c8287e2 bpo-30508: Don't log exceptions if Task/Future "cancel()" method was called. (#2110) 2017-06-11 14:11:47 +00:00
Mariatta
ea8b34868c bpo-28556: Updates to typing module (GH-2076) (GH-2088)
This PR contains two updates to typing module:

- Support ContextManager on all versions (original PR by Jelle Zijlstra).
- Add generic AsyncContextManager..
(cherry picked from commit 29fda8db16)
2017-06-10 14:41:38 -07:00