classification
Title: regrtest: capture stdout (-W) option is incompatible with refleak hunter (-R)
Type: Stage: resolved
Components: Tests Versions: Python 3.7, Python 3.6, Python 3.5
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: haypo, serhiy.storchaka, zach.ware
Priority: normal Keywords:

Created on 2016-05-24 15:20 by haypo, last changed 2017-06-28 01:06 by haypo. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 1651 merged haypo, 2017-05-18 17:30
PR 1656 merged haypo, 2017-05-18 20:05
PR 1660 merged haypo, 2017-05-18 20:51
Messages (6)
msg266254 - (view) Author: STINNER Victor (haypo) * (Python committer) Date: 2016-05-24 15:20
The -R option of regrtest replaces sys.stdout with a io.StringIO object. Problem: the refleak are hunted after stdout is replaced, and so each print() increaes the total reference counter which is seen as a leak.

Example:

$ cat Lib/test/test_noop.py 
"noop"

$ ./python -u -m test -R 3:3 -W test_noop 
Run tests sequentially
0:00:00 [1/1] test_noop

----------------------------------------------------------------------
Ran 0 tests in 0.000s

OK
beginning 6 repetitions
123456

----------------------------------------------------------------------
Ran 0 tests in 0.000s

OK
.
(...)
test_noop leaked [9, 9, 9] references, sum=27
test_noop failed
1 test failed:
    test_noop
Total duration: 0:00:01
msg293936 - (view) Author: STINNER Victor (haypo) * (Python committer) Date: 2017-05-18 20:03
New changeset fcdd9b6b7e73427ce5aa63cf095312f603c4edce by Victor Stinner in branch 'master':
bpo-27103: regrtest disables -W if -R is used (#1651)
https://github.com/python/cpython/commit/fcdd9b6b7e73427ce5aa63cf095312f603c4edce
msg293937 - (view) Author: STINNER Victor (haypo) * (Python committer) Date: 2017-05-18 20:07
It seems like Python 2.7 is not affected.

I will apply my workaround to 3.5, 3.6 and master, since Zachary created a buildbot testing 2.7, 3.5, 3.6 and master branches.
msg293939 - (view) Author: STINNER Victor (haypo) * (Python committer) Date: 2017-05-18 20:36
New changeset 2773add19aff873377d81e3bb6ab8aa942756f5a by Victor Stinner in branch '3.6':
bpo-27103: regrtest disables -W if -R is used (#1651) (#1656)
https://github.com/python/cpython/commit/2773add19aff873377d81e3bb6ab8aa942756f5a
msg293949 - (view) Author: STINNER Victor (haypo) * (Python committer) Date: 2017-05-19 05:12
New changeset 9503dd1e1865bb873a1f72f63ae384bba8462c5e by Victor Stinner in branch '3.5':
bpo-27103: regrtest disables -W if -R is used (#1660)
https://github.com/python/cpython/commit/9503dd1e1865bb873a1f72f63ae384bba8462c5e
msg297100 - (view) Author: STINNER Victor (haypo) * (Python committer) Date: 2017-06-28 01:06
While the root issue is not fixed, at least -W doesn't cause issues anymore with -R, so I consider that the "bug" was fixed ;-)
History
Date User Action Args
2017-06-28 01:06:44hayposetstatus: open -> closed
resolution: fixed
messages: + msg297100

stage: resolved
2017-05-19 05:12:59hayposetmessages: + msg293949
2017-05-18 20:51:25hayposetpull_requests: + pull_request1755
2017-05-18 20:36:53hayposetmessages: + msg293939
2017-05-18 20:07:34hayposetnosy: + zach.ware

messages: + msg293937
versions: + Python 3.5, Python 3.7
2017-05-18 20:05:32hayposetpull_requests: + pull_request1750
2017-05-18 20:03:26hayposetmessages: + msg293936
2017-05-18 17:41:42serhiy.storchakasetnosy: + serhiy.storchaka
2017-05-18 17:30:26hayposetpull_requests: + pull_request1746
2016-05-24 15:20:30haypocreate