[issue18751] A manager's server never joins its threads

2016-06-04 Thread Yusuke Tsutsumi

Yusuke Tsutsumi added the comment:

I'm interested in taking this on. I can do the following:

* keep track of the threads in a field attached to the class
* handle thread synchronization and cleanup in the finally block
* set a flag on the exception, which ensures the loop completes, vs immediately 
passing.

The part I'm unclear on is a good garbage collection strategy. I'm thinking:

* set some configurable period to clean up the threads (every 10s by default. 
Rapid enough to ensure cleanup, but not fast enough to run every time and 
significantly slow down responses)
* at the specific threshold, run the cleanup script.
* on cleanup, check every thread if it's alive. explicit del the ones that are 
not. 

If it sounds good, I can start a patch.

--
nosy: +Yusuke Tsutsumi

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



[issue26467] Add async magic method support to unittest.mock.Mock

2016-06-04 Thread Yusuke Tsutsumi

Yusuke Tsutsumi added the comment:

I'm interested in taking this on. I'm considering for this approach, creating a 
new MagicProxy class specifically for async, and assigning __aexit__ and 
__aenter__ to those.

The __call__ method itself has to be detected as asynchronous, and I don't 
believe it's possible for a __call__ to behave appropriately for both 
asynchronous and synchronous cases.

--
nosy: +tsutsumi

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



[issue26467] Add async magic method support to unittest.mock.Mock

2016-06-05 Thread Yusuke Tsutsumi

Yusuke Tsutsumi added the comment:

Taking a look at the code, this may require a bit more discussion.

Mock's classes create copies of themselves when an attribute is accessed. As 
such, I can't just add __aexit__ and have it generate a different mock type 
entirely, unless I know exactly what an async variant of this mock is.

If there was a way to specifically provide a function for asynchronous 
situations, like __acall__, that would make this a lot easier as well.

Anyway, my proposal now is:

create new classes MockAsync and MagicMockAsync, and have MockAsync and 
MagicMockAsync implement the __aexit__ and __aenter__ methods.

How is that as an approach?

--

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