Commit Graph

80182 Commits

Author SHA1 Message Date
Victor Stinner a5bb62436e [2.7] bpo-30283: regrtest: backport test_slow_interrupted() and 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).
2017-05-11 11:30:23 +02:00
Victor Stinner 3837d9797c bpo-15526: test_startfile changes the cwd (#1537)
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: 8a53dbeb7a
2017-05-11 01:23:19 +02:00
Xiang Zhang 05469fa1c0 bpo-30281: Fix the default value for stop in PySlice_Unpack() (#1531) (#1480) 2017-05-10 19:20:28 +08:00
Victor Stinner 88321413a7 gitignore: add rules for the PC/ directory (#1514)
[2.7] gitignore: add rules for the PC/ directory
2017-05-10 02:38:28 +02:00
torsava a473a73d0c [2.7] bpo-29243: Fix Makefile with respect to --enable-optimizations (GH-1478) (#1522)
* bpo-29243: Fix Makefile with respect to --enable-optimizations

When using the Profile Guided Optimization (./configure --enable-optimizations)
Python is built not only during `make` but rebuilt again during `make test`,
`make install` and others. This patch fixes the issue.

Note that this fix produces no change at all in the Makefile if configure is
run witout --enable-optimizations.

* !squash.
(cherry picked from commit a1054c3b00)
2017-05-09 18:04:29 +02:00
Victor Stinner 453a685702 bpo-30283: Backport regrtest features from master to 2.7 (#1516)
* 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
2017-05-09 17:06:34 +02:00
Victor Stinner d2aff60719 [2.7] bpo-30283: Backport test_regrtest from master to 2.7 (#1513)
* 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
2017-05-09 13:57:20 +02:00
Victor Stinner c8a77d3394 Fix SyntaxWarning on importing test_inspect (#1512)
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.
2017-05-09 11:53:16 +02:00
Xiang Zhang 4e7457b853 bpo-29990: Fix range checking in GB18030 decoder (#1509) 2017-05-09 12:18:56 +08:00
Victor Stinner 228da42961 bpo-30258: Fix handling of child error in regrtest (#1477)
Don't stop the worker thread if a child failed.
2017-05-05 10:28:35 +02:00
Victor Stinner 03b278895f bpo-30265: support.unlink() don't catch any OSError (#1456)
support.unlink() now only ignores ENOENT and ENOTDIR, instead of
ignoring any OSError exception.
2017-05-05 10:27:34 +02:00
Serhiy Storchaka 5d7a18f3b6 [2.7] bpo-30243: Fixed the possibility of a crash in _json. (GH-1420) (#1471)
It was possible to get a core dump by using uninitialized
_json objects. Now __new__ methods create initialized objects.
__init__ methods are removed..
(cherry picked from commit 76a3e51a40)
2017-05-05 11:21:45 +03:00
Victor Stinner d81f9e24ea bpo-30264: ExpatParser now closes the source (#1476)
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.
2017-05-05 10:11:55 +02:00
Victor Stinner fd6094cdeb Relax test timing (bpo-29861) to avoid sporadic failures (#1120) (#1472)
(cherry picked from commit 685cdb9acc)
2017-05-05 09:47:11 +02:00
Benjamin Peterson ef4c6ba169 Revert "Issue #29094: Offsets in a ZIP file created with extern file object and modes" (#1467)
This reverts commit 0f4ed2cdc6 (though, the tests are retained) and the followup 58ab4b57da.

See discussion on bpo-29094.
2017-05-04 23:54:43 -07:00
Victor Stinner 8a19eb24c9 bpo-23404: make touch becomes make regen-all (#1466)
Don't rebuild generated files based on file modification time
anymore, the action is now explicit. Replace "make touch"
with "make regen-all".

Changes:

* Remove "make touch", Tools/hg/hgtouch.py and .hgtouch
* Add a new "make regen-all" command to rebuild all generated files
* Add subcommands to only generate specific files:

  - regen-ast: Include/Python-ast.h and Python/Python-ast.c
  - regen-grammar: Include/graminit.h and Python/graminit.c
  - regen-opcode-targets: Python/opcode_targets.h

* Add PYTHON_FOR_REGEN variable
* pgen is now only built by by "make regen-grammar"
* Add $(srcdir)/ prefix to paths to source files to handle correctly
  compilation outside the source directory
2017-05-05 03:14:23 +02:00
Victor Stinner e81e355a8e bpo-30108: Fix test_site setUpModule() (#1460)
Oops, I forgot that PermissionError was introduced in Python 3.3!
Replace PermissionError with OSError and check on errno.
2017-05-04 18:52:26 +02:00
Victor Stinner 78064387e5 bpo-30108: Restore sys.path in test_site (#1197) (#1459)
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 b85c136903)
2017-05-04 18:21:52 +02:00
Victor Stinner 9fb061ba9c Fix test_ftplib warning if IPv6 is not available (#1457)
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 ...>}
2017-05-04 18:10:30 +02:00
Victor Stinner 0f7f676606 test_distutils: test_build_ext uses EnvironGuard (#1458)
Use EnvironGuard on BuildExtTestCase to save/restore os.environ, to fix the
following warning:

Warning -- os.environ was modified by test_distutils

MSVCCompiler.initialize() of distutils.msvc9compiler modifies
os.environ.
2017-05-04 18:10:09 +02:00
Mariatta e1b02ff588 [2.7] bpo-28315: Improve code examples in docs (GH-1372) (#1447)
Replace
   File "<stdin>", line 1, in ?
with
   File "<stdin>", line 1, in <module>.
(cherry picked from commit 8856940cf2)
2017-05-03 18:54:28 -07:00
Serhiy Storchaka 74f0db885f [2.7] bpo-30236: Backported regrtest options -m and -G. (#1394) 2017-05-04 00:23:50 +03:00
Victor Stinner 8cf7ea22fc Add Appveyor to Python 2.7 branch (#1434)
* Add Appveyor to Python 2.7 branch

* Adapt AppVeyor config for Python 2

* Replace -j0 with -j2: -j0 is ignored on Python 2
* Replace --slowest with --slow
* Remove --timeout option (it was introduced in Python 3)
2017-05-03 18:42:42 +02:00
Victor Stinner 2c27731901 bpo-30257: _bsddb: Fix newDBObject() (#1428)
Don't set cursorSetReturnsNone to DEFAULT_CURSOR_SET_RETURNS_NONE
anymore if self->myenvobj is set.

Fix a GCC warning on the strange indentation.
2017-05-03 18:04:18 +02:00
Victor Stinner c991eb280e bpo-30258: regrtest handles child process crash (#1431)
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.
2017-05-03 17:28:28 +02:00
Victor Stinner 15f8d0d360 test_distutils: use EnvironGuard (#1433)
Use EnvironGuard on InstallTestCase and UtilTestCase.

Backport fixes from master to prevent the following warning:

Warning -- os.environ was modified by test_distutils
2017-05-03 17:28:10 +02:00
Victor Stinner 2b183b87d2 Update .gitignore (#1435)
Ignore more generated files and test data downloaded by tests.
2017-05-03 17:27:17 +02:00
Victor Stinner f6a3133972 bpo-30255: Clip step in _PySlice_Unpack() (#1429)
In PySlice_IndicesEx, clip the step to [-PY_SSIZE_T_MAX,
PY_SSIZE_T_MAX] rather than [PY_SSIZE_T_MIN, PY_SSIZE_T_MAX].

(cherry picked from commit e6fc7401a9)
2017-05-03 16:00:12 +02:00
Victor Stinner 0d493795c8 regrtest: always show before/after of modified env (#1407) (#1409)
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 ec4b17239d)
(cherry picked from commit 2298235023)
2017-05-03 03:47:44 +02:00
Victor Stinner d1c862ffa7 bpo-30199: test_ssl closes all asyncore channels (#1381) (#1408)
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 1dae7450c6)
2017-05-03 03:47:34 +02:00
Victor Stinner df5692549a bpo-30232: Support Git worktree in configure.ac (#1402)
Don't test if .git/HEAD file exists, but only if the .git file (or
directory) exists.
2017-05-03 00:05:45 +02:00
Victor Stinner 8105dd7f75 bpo-30223: Add global in regrtest main_in_temp_cwd (#1399) 2017-05-02 23:43:25 +02:00
Victor Stinner fd6c8bb89e bpo-27593: Revise git SCM build info. (#744) (#746) (#1392)
Use --short form of git hash.  Use output from "git describe" for tag.

Expected outputs:
1. previous hg
2. previous git
3. updated git

Release (tagged) build:
1. Python 3.7.0a0 (v3.7.0a0:4def2a2901a5, ...
2. Python 3.7.0a0 (v3.7.0a0^0:05f53735c8912f8df1077e897f052571e13c3496, ...
3. Python 3.7.0a0 (v3.7.0a0:05f53735c8, ...

Development build:
1. Python 3.7.0a0 (default:41df79263a11, ...
2. Python 3.7.0a0 (master:05f53735c8912f8df1077e897f052571e13c3496, ...
3. Python 3.7.0a0 (heads/master-dirty:05f53735c8, ...

"dirty" means the working tree has uncommitted changes.
See "git help describe" for more info.
(cherry picked from commit 554626ada7)
(cherry picked from commit ed512cba78)
2017-05-02 21:50:09 +02:00
Serhiy Storchaka 8e158b2316 [2.7] bpo-30223: Fix test_xpickle for Python 2.4. (#1395) 2017-05-02 21:56:52 +03:00
Serhiy Storchaka 43566aee12 [2.7] bpo-30223: Add Lib/test/__main__.py. (#1373)
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.
2017-05-02 18:26:25 +03:00
Victor Stinner 2c7085fd7b bpo-27593: Get SCM build info from git instead of hg (#1327)
Based on commit 5c4b0d063a by Ned
Deily, which is based on original patches by Brett Cannon and Steve
Dower.

Remove also the private _Py_svnversion() function and SVNVERSION
variable.

Note: Py_SubversionRevision() and Py_SubversionShortBranch() are
unchanged, they are part of the public API.
2017-05-02 16:55:50 +02:00
Serhiy Storchaka 6bed8f95d7 bpo-30207: Install the Lib/test/support directory. (#1369) 2017-05-01 19:53:45 +03:00
Serhiy Storchaka a694e092f6 bpo-30207: Rename test.test_support to test.support. (#1353)
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.
2017-04-30 11:36:58 +03:00
csabella 4734c2d5c0 [2.7] bpo-30208: DOC: fix small typos in IDLE (#1358)
(cherry picked from commit d9af73330f)
2017-04-29 20:44:04 -04:00
Serhiy Storchaka 941ea53b57 [2.7] bpo-30197: Enhance swap_attr() and backport swap_item() in test.test_support. (#1341) (#1347)
(cherry picked from commit d1a1def7bf)
2017-04-28 20:06:30 +03:00
Victor Stinner 5f4056a3c9 Fix "make tags" command (#1337)
Backport enhancements from master, commits:

* 9c4bfa6669e220efdd379b9f8e7db32bb4e25e72: "make tags": remove -t
  option of ctags. The option was kept for backward compatibility,
  but it was completly removed recently. Patch written by Stéphane
  Wirtel.
* cf0ac6a71ae51249a05521f49c1a0fabbb948488: Fix "make tags": set
  locale to C to call sort
* 8a543c0bc7347d5b333f334d157bf4a7cd33c14a: `make tags` fixes (GH-717)
2017-04-28 03:41:40 +02:00
Victor Stinner 219a3f991a Update gitignore from master (#1329)
Ignore more generated files.
2017-04-28 02:56:40 +02:00
Mariatta 24404b4c92 [2.7] bpo-30182: Use the correct name for ISO in Unicode HOWTO. (GH-1312). (#1315)
(cherry picked from commit 6fde770e4e)
2017-04-26 22:25:40 -07:00
Dong-hee Na 19b3a4885c [2.7] bpo-30142: Remove "callable" from the 2to3fixer documentation. (GH-1305) 2017-04-26 09:55:32 -07:00
Serhiy Storchaka bfc7dff63b [2.7] bpo-15718: Document the upper bound constrain on the __len__ return value. (GH-1256). (#1261)
(cherry picked from commit 85157cd89a)
2017-04-23 08:58:09 +03:00
Mariatta 91e5ee597e [2.7] Add missing .gitignore entries for VS2015 IntelliSense DB (GH-1223). (#1227)
(cherry picked from commit 8e675286a9)
2017-04-20 20:56:11 -07:00
Berker Peksag fb12365c43 Remove redundant comma in argparse HOWTO (GH-1141)
Reported by Sean Canavan on docs@p.o.

(cherry picked from commit 8526fb74ed)
2017-04-20 07:41:01 +03:00
cocoatomo 450a69c6a4 bpo-19225: Remove duplicated description for standard warning categories (GH-1068) 2017-04-20 06:57:21 +03:00
Serhiy Storchaka 2a1bf0633c [2.7] [3.5] bpo-30070: Fixed leaks and crashes in errors handling in the parser module. (GH-1131). (GH-1185) (#1189)
(cherry picked from commit a79f4c2195).
(cherry picked from commit 952a05e4e2)
2017-04-20 00:48:57 +03:00
Serhiy Storchaka 64aa4df850 [2.7] bpo-30061: Check if PyObject_Size()/PySequence_Size()/PyMapping_Size() (GH-1096) (GH-1180) (#1183)
raised an error.

(cherry picked from commit bf623ae884)
(cherry picked from commit 680fea4)
2017-04-19 22:34:58 +03:00