Repository navigation
regrtest refleak: implement bisection feature #73698
Copy link
Copy link
Closed
Labels
3.7 (EOL)end of lifeend of lifetestsTests in the Lib/test dirTests in the Lib/test dirtype-featureA feature request or enhancementA feature request or enhancement
Description
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
assignee = None
closed_at = <Date 2018-05-30.15:25:05.761>
created_at = <Date 2017-02-09.11:46:03.741>
labels = ['3.7', 'type-feature', 'tests']
title = 'regrtest refleak: implement bisection feature'
updated_at = <Date 2019-05-02.02:52:21.824>
user = 'https://github.com/vstinner'bugs.python.org fields:
activity = <Date 2019-05-02.02:52:21.824>
actor = 'miss-islington'
assignee = 'none'
closed = True
closed_date = <Date 2018-05-30.15:25:05.761>
closer = 'vstinner'
components = ['Tests']
creation = <Date 2017-02-09.11:46:03.741>
creator = 'vstinner'
dependencies = []
files = ['46918', '46933', '46934']
hgrepos = []
issue_num = 29512
keywords = ['patch']
message_count = 21.0
messages = ['287405', '294827', '294962', '294964', '294965', '295449', '295450', '297081', '297093', '297421', '297566', '297576', '297586', '299043', '299045', '299047', '306825', '306876', '318134', '318191', '318192']
nosy_count = 4.0
nosy_names = ['vstinner', 'quentel', 'serhiy.storchaka', 'yselivanov']
pr_nums = ['2452', '2513', '2540', '2541', '4522', '7229', '13040', '13051', '13050']
priority = 'normal'
resolution = 'fixed'
stage = 'resolved'
status = 'closed'
superseder = None
type = 'enhancement'
url = 'https://bugs.python.org/issue29512'
versions = ['Python 3.7']Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
3.7 (EOL)end of lifeend of lifetestsTests in the Lib/test dirTests in the Lib/test dirtype-featureA feature request or enhancementA feature request or enhancement
Activity
vstinner commentedon Feb 9, 2017
It would be great to be able to list which methods cause a reference leak.
Example right now on the 3.6 branch:
----
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?
vstinner commentedon May 31, 2017
First step: I created the issue bpo-30523, "unittest: add --list-tests option to only display the list of test names, don't run tests".
serhiy-storchaka commentedon Jun 1, 2017
I don't understand how bpo-30523 and bpo-30540 can help to resolve this issue.
vstinner commentedon Jun 1, 2017
Serhiy: "I don't understand how bpo-30523 and bpo-30540 can help to resolve this issue."
Example of usage:
./python bisect_test.py test_tools tests bisect -n 5
vstinner commentedon Jun 1, 2017
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 ;-)
vstinner commentedon Jun 8, 2017
Updated script: support Windows, fix cmdline help.
vstinner commentedon Jun 8, 2017
Oops, I uploaded the wrong version. It should now work.
vstinner commentedon Jun 28, 2017
New changeset 84d9d14 by Victor Stinner in branch 'master':
bpo-29512: Add test.bisect, bisect failing tests (bpo-2452)
84d9d14
vstinner commentedon Jun 28, 2017
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 ;-)
vstinner commentedon Jun 30, 2017
New changeset a3ca94d by Victor Stinner in branch '3.6':
[3.6] bpo-29512, bpo-30776: Backport regrtest enhancements from master to 3.6 (bpo-2513)
a3ca94d
vstinner commentedon Jul 3, 2017
New changeset 0b12107 by Victor Stinner in branch '3.5':
[3.5] bpo-29512, bpo-30764, bpo-30776: Backport regrtest enhancements from 3.6 to 3.5 (bpo-2540)
0b12107
vstinner commentedon Jul 3, 2017
New changeset d7955b8 by Victor Stinner in branch '2.7':
[2.7] bpo-29512, bpo-30764: Backport regrtest enhancements from 3.5 to 2.7 (bpo-2541)
d7955b8
vstinner commentedon Jul 3, 2017
Ok! "python -m test.bisect" is now available in 2.7, 3.5, 3.6 and master branches ;-)
PierreQuentel commentedon Jul 25, 2017
Maybe it's me who is doing things wrong, but when I run Lib/test/test_httpservers.py I get this strange error :
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 ?
serhiy-storchaka commentedon Jul 25, 2017
There are many ways of running tests, and some of them are broken now.
======================================================================
ERROR: test_backcompatibility (main.TestBisectC)
----------------------------------------------------------------------
...
vstinner commentedon Jul 25, 2017
Workarounds:
...
File "c:\python36\lib\random.py", line 48, in <module>
import bisect as _bisect
File "C:\cpython\Lib\test\bisect.py", line 27, in <module>
...
Oh. Lib/test/ should not be in sys.path. "import bisect" loaded Lib/test/bisect.py instead of Lib/bisect.py. See my commit 3050987 in Python 2.7:
(regrtest in master already does something similar.)
But the sys.path is only fixed when regrtest is used...
... if you run Lib/test/test_xxx.py directly, Lib/test/ is added to sys.path, except if you use -I:
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.
vstinner commentedon Nov 23, 2017
New changeset 448c673 by Victor Stinner in branch '2.7':
bpo-29512: Fix Lib/test/bisect.py shebang (bpo-4522)
448c673
vstinner commentedon Nov 24, 2017
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?
vstinner commentedon May 29, 2018
I created the PR 7229 to rename Lib/test/bisect.py to Lib/test/bisect_cmd.py.
vstinner commentedon May 30, 2018
New changeset 823c295 by Victor Stinner in branch '2.7':
bpo-29512: Rename Lib/test/bisect.py to bisect_cmd.py (bpo-7229)
823c295
vstinner commentedon May 30, 2018
One year later, all issues have now been fixed ;-)