[issue27787] Avoid test_main() in test_httplib; gc.collect() dangling threads

2016-08-23 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 31e4495a34ce by Terry Jan Reedy in branch 'default':
Issue #27787: No longer call deleted test_main().
https://hg.python.org/cpython/rev/31e4495a34ce

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue27787] Avoid test_main() in test_httplib; gc.collect() dangling threads

2016-08-23 Thread Martin Panter

Changes by Martin Panter :


--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue27787] Avoid test_main() in test_httplib; gc.collect() dangling threads

2016-08-23 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 1f73355afebb by Martin Panter in branch 'default':
Issue #27787: Remove test_main() and hard-coded list of test classes
https://hg.python.org/cpython/rev/1f73355afebb

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue27787] Avoid test_main() in test_httplib; gc.collect() dangling threads

2016-08-20 Thread Martin Panter

Martin Panter added the comment:

I committed the gc_collect() change to 3.5 as well, because it helped me with a 
separate test case.

Here is the remaining change, for 3.6 only. I added a timeout to the join() 
call. This matches the @reap_threads decorator, which times out after 1 s.

--
versions: +Python 3.5
Added file: http://bugs.python.org/file44163/httplib-tests.v2.patch

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue27787] Avoid test_main() in test_httplib; gc.collect() dangling threads

2016-08-20 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 7ddbc2263943 by Martin Panter in branch '3.5':
Issue #27787: Clean up weak references before checking for dangling threads
https://hg.python.org/cpython/rev/7ddbc2263943

New changeset e5777c5d108c by Martin Panter in branch 'default':
Issue #27787: Merge regrtest fixup from 3.5
https://hg.python.org/cpython/rev/e5777c5d108c

--
nosy: +python-dev

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue27787] Avoid test_main() in test_httplib; gc.collect() dangling threads

2016-08-17 Thread Martin Panter

Martin Panter added the comment:

Yes I agree it would make sense to separate the test_httplib changes from the 
general change. I thought this task would be a very easy change, and noticed it 
wasn’t that simple the last minute.

I would like to adjust the cleanup call to

self.addCleanup(thread.join, float(1))

That should be a better equivalent to what @reap_threads does. Or I can just 
use @reap_threads directly on test_response_fileno(), if people prefer.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue27787] Avoid test_main() in test_httplib; gc.collect() dangling threads

2016-08-17 Thread STINNER Victor

STINNER Victor added the comment:

Your patch changes 3 different things. After the code review, I suggest to 
split it in two changes (fix test_httplib threading ripper, fix save_env, fix 
test_httplib main).

--
nosy: +haypo

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue27787] Avoid test_main() in test_httplib; gc.collect() dangling threads

2016-08-17 Thread Martin Panter

New submission from Martin Panter:

In Issue 12319, there are many iterations of a patch that adds a new TestCase 
subclass to Lib/test/test_httplib.py. However it never got run by the main 
regrtest infrastructure, because nobody remembered to add the class to the list 
of test classes. So I want to remove test_main(). It seems this would let the 
classes be automatically discovered (like normal unittest usage).

I understand @reap_threads is to avoid background threads continuing between 
tests (especially when a test fails). I improved the cleanup of the background 
thread in one test. There are three other test methods using 
test.ssl_servers.make_https_server(), which also runs a background thread, but 
that already seems to clean itself up properly, via 
case.addCleanup(server.join).

I found that the test infrastructure randomly complained about dangling threads 
without @reap_threads. It uses a set of weak references to thread objects. The 
solution seems to be to call gc.collect() before checking. This is what 
@reap_threads does, so maybe my patch would eliminate the need for 
@reap_threads in other test files as well. In fact, if everybody called join() 
on their threads, we may be able to eliminate @reap_threads altogether.

--
components: Tests
files: httplib-tests.patch
keywords: patch
messages: 272954
nosy: martin.panter
priority: normal
severity: normal
stage: patch review
status: open
title: Avoid test_main() in test_httplib; gc.collect() dangling threads
type: enhancement
versions: Python 3.6
Added file: http://bugs.python.org/file44134/httplib-tests.patch

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com