msg287405 - (view) |
Author: STINNER Victor (vstinner) *  |
Date: 2017-02-09 11:46 |
It would be great to be able to list which methods cause a reference leak. Example right now on the 3.6 branch: ---- $ ./python -m test -R 3:3 test_os Run tests sequentially 0:00:00 [1/1] test_os beginning 6 repetitions 123456 ...... test_os leaked [124, 124, 124] references, sum=372 test_os leaked [114, 114, 114] memory blocks, sum=342 test_os failed in 32 sec 1 test failed: test_os Total duration: 32 sec Tests result: FAILURE ---- Which methods caused the refleak? Is it possible to list test methods of a test file using unittest? |
|
|
msg294827 - (view) |
Author: STINNER Victor (vstinner) *  |
Date: 2017-05-31 09:26 |
First step: I created the issue #30523, "unittest: add --list-tests option to only display the list of test names, don't run tests". |
|
|
msg294962 - (view) |
Author: Serhiy Storchaka (serhiy.storchaka) *  |
Date: 2017-06-01 20:22 |
I don't understand how and can help to resolve this issue. |
|
|
msg294964 - (view) |
Author: STINNER Victor (vstinner) *  |
Date: 2017-06-01 20:46 |
Serhiy: "I don't understand how and can help to resolve this issue." - produces a list of all test methods - allows to pass a file to filter tests - attached bisect_test.py takes an input file produced by --list-tests and uses --matchfile to run tests Example of usage: ./python bisect_test.py test_tools tests bisect -n 5 * bisect -R 3:3 on test_tools * tests contains the list of test identifiers to test_tools * write result into the file "bisect" * stop bisection when there is 5 tests or less |
|
|
msg294965 - (view) |
Author: STINNER Victor (vstinner) *  |
Date: 2017-06-01 20:47 |
The next step is to add a command to regrtest implementing all steps. Or maybe this script is enough? At least, it's enough for my needs ;-) |
|
|
msg295449 - (view) |
Author: STINNER Victor (vstinner) *  |
Date: 2017-06-08 15:48 |
Updated script: support Windows, fix cmdline help. |
|
|
msg295450 - (view) |
Author: STINNER Victor (vstinner) *  |
Date: 2017-06-08 15:53 |
Oops, I uploaded the wrong version. It should now work. |
|
|
msg297081 - (view) |
Author: STINNER Victor (vstinner) *  |
Date: 2017-06-28 00:24 |
New changeset 84d9d14a1fa395fbd21262ba195490be25a7b3bc by Victor Stinner in branch 'master': bpo-29512: Add test.bisect, bisect failing tests (#2452) https://github.com/python/cpython/commit/84d9d14a1fa395fbd21262ba195490be25a7b3bc |
|
|
msg297093 - (view) |
Author: STINNER Victor (vstinner) *  |
Date: 2017-06-28 00:59 |
Ok, I pushed a first implementation. It's problaby buggy and incomplete, but it's better than nothing, and can be enhanced later. I prefer to play with it longer before starting to backport it to other branches, to not have to backport changes multiple times. Thanks Yury for the review ;-) |
|
|
msg297421 - (view) |
Author: STINNER Victor (vstinner) *  |
Date: 2017-06-30 15:31 |
New changeset a3ca94d0504157a112a1f89bfe8be1307116fc73 by Victor Stinner in branch '3.6': [3.6] bpo-29512, bpo-30776: Backport regrtest enhancements from master to 3.6 (#2513) https://github.com/python/cpython/commit/a3ca94d0504157a112a1f89bfe8be1307116fc73 |
|
|
msg297566 - (view) |
Author: STINNER Victor (vstinner) *  |
Date: 2017-07-03 11:17 |
New changeset 0b1210739d12c26e4a161ffd494bd572d49b2483 by Victor Stinner in branch '3.5': [3.5] bpo-29512, bpo-30764, bpo-30776: Backport regrtest enhancements from 3.6 to 3.5 (#2540) https://github.com/python/cpython/commit/0b1210739d12c26e4a161ffd494bd572d49b2483 |
|
|
msg297576 - (view) |
Author: STINNER Victor (vstinner) *  |
Date: 2017-07-03 13:07 |
New changeset d7955b8196578306e9d86f6c61c9cb3ee72edab0 by Victor Stinner in branch '2.7': [2.7] bpo-29512, bpo-30764: Backport regrtest enhancements from 3.5 to 2.7 (#2541) https://github.com/python/cpython/commit/d7955b8196578306e9d86f6c61c9cb3ee72edab0 |
|
|
msg297586 - (view) |
Author: STINNER Victor (vstinner) *  |
Date: 2017-07-03 13:53 |
Ok! "python -m test.bisect" is now available in 2.7, 3.5, 3.6 and master branches ;-) |
|
|
msg299043 - (view) |
Author: Pierre Quentel (quentel) * |
Date: 2017-07-25 07:21 |
Maybe it's me who is doing things wrong, but when I run Lib/test/test_httpservers.py I get this strange error : Traceback (most recent call last): File "C:\cpython\Lib\test\test_httpservers.py", line 7, in from http.server import BaseHTTPRequestHandler, HTTPServer, \ File "c:\python36\lib\http\server.py", line 92, in import email.utils File "c:\python36\lib\email\utils.py", line 28, in import random File "c:\python36\lib\random.py", line 48, in import bisect as _bisect File "C:\cpython\Lib\test\bisect.py", line 27, in import tempfile File "c:\python36\lib\tempfile.py", line 45, in from random import Random as _Random ImportError: cannot import name 'Random' I see that the bisect module is loaded from location /test/bisect.py because of the script introduced in the resolution of this issue. Is it intentional to give it the same name as a module of the standard library ? |
|
|
msg299045 - (view) |
Author: Serhiy Storchaka (serhiy.storchaka) *  |
Date: 2017-07-25 08:16 |
There are many ways of running tests, and some of them are broken now. $ ./python Lib/test/test_bisect.py EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE ====================================================================== ERROR: test_backcompatibility (__main__.TestBisectC) ---------------------------------------------------------------------- Traceback (most recent call last): File "Lib/test/test_bisect.py", line 34, in setUp (self.module.bisect_right, [], 1, 0), AttributeError: module 'bisect' has no attribute 'bisect_right' ... |
|
|
msg299047 - (view) |
Author: STINNER Victor (vstinner) *  |
Date: 2017-07-25 09:07 |
Workarounds: * ./python -m test test_httpservers * ./python -I Lib/test/test_httpservers.py > Maybe it's me who is doing things wrong, but when I run Lib/test/test_httpservers.py I get this strange error : ... File "c:\python36\lib\random.py", line 48, in import bisect as _bisect File "C:\cpython\Lib\test\bisect.py", line 27, in ... Oh. Lib/test/ should not be in sys.path. "import bisect" loaded Lib/test/bisect.py instead of Lib/bisect.py. See my commit 3050987d85d7cf8cdd4b3c053e673d13cd8dfb12 in Python 2.7: * regrtest now removes '' and Lib/test/ from sys.path * Use absolute import in test_bisect (regrtest in master already does something similar.) But the sys.path is only fixed when regrtest is used... > There are many ways of running tests, and some of them are broken now. > $ ./python Lib/test/test_bisect.py ... if you run Lib/test/test_xxx.py directly, Lib/test/ is added to sys.path, except if you use -I: $ ./python -I Lib/test/test_bisect.py .................................... ---------------------------------------------------------------------- Ran 36 tests in 0.094s OK I didn't know that "./python Lib/test/test_bisect.py" was broken :-( Maybe Lib/test/support/__init__.py can remove Lib/test/ from sys.path? Another option is to move or rename Lib/test/bisect.py. For example, replace "./python -m test.bisect ..." with "./python -m test bisect ..." (or maybe "./python -m test --bisect ..."). The problem is that bisect has extra options, but we can add a bisect prefix to these options. I reopen this issue. |
|
|
msg306825 - (view) |
Author: STINNER Victor (vstinner) *  |
Date: 2017-11-23 16:04 |
New changeset 448c6739877a4143a2c3599f041fa6127f354044 by Victor Stinner in branch '2.7': bpo-29512: Fix Lib/test/bisect.py shebang (#4522) https://github.com/python/cpython/commit/448c6739877a4143a2c3599f041fa6127f354044 |
|
|
msg306876 - (view) |
Author: STINNER Victor (vstinner) *  |
Date: 2017-11-24 01:39 |
Python 2.7.14 was released with test.bisect. While there are corner cases, do we really have to do something? The simplest fix is just to rename Lib/test/bisect.py to Lib/test/bisect_cmd.py in Python 2.7. It's a tool written for CPython developer, it's CLI is not stable nor documented. It just mean replacing "./python -m test.bisect ..." with "./python -m test.bisect_cmd ...", not a big deal. What do you think of renaming the script? |
|
|
msg318134 - (view) |
Author: STINNER Victor (vstinner) *  |
Date: 2018-05-29 22:45 |
I created the PR 7229 to rename Lib/test/bisect.py to Lib/test/bisect_cmd.py. |
|
|
msg318191 - (view) |
Author: STINNER Victor (vstinner) *  |
Date: 2018-05-30 15:24 |
New changeset 823c295efa4efea93cadc640ed6122cd9d86cec4 by Victor Stinner in branch '2.7': bpo-29512: Rename Lib/test/bisect.py to bisect_cmd.py (#7229) https://github.com/python/cpython/commit/823c295efa4efea93cadc640ed6122cd9d86cec4 |
|
|
msg318192 - (view) |
Author: STINNER Victor (vstinner) *  |
Date: 2018-05-30 15:25 |
One year later, all issues have now been fixed ;-) |
|
|