[issue21345] multiprocessing.Pool._handle_workers sleeps too long

2014-04-24 Thread Johannes Baiter
New submission from Johannes Baiter: While testing a module that uses multiprocessing.Pool to distribute load across multiple processes, I noticed that my test suite was copmleting very quickly (~0.15s) on Python 2.6, while Python 2.7 and above took around 10x as long (~1.6s). Upon debugging

[issue20968] mock.MagicMock does not mock __truediv__

2014-03-31 Thread Johannes Baiter
Johannes Baiter added the comment: Sorry for commenting so late, I submitted a version of the patch with unit tests roughly two weeks ago, I just forgot to mention it in a comment. Hereby fixed :-) -- ___ Python tracker rep...@bugs.python.org http

[issue20968] mock.MagicMock does not mock __truediv__

2014-03-19 Thread Johannes Baiter
Johannes Baiter added the comment: From looking at 'test_numerics', only 'add' is currently tested. Probably since the mechanism for all of the numeric magic methods is the same (i.e. create __op__, __iop__, __rop__). Should I add a test for __truediv__ and its inplace and right variants

[issue20968] mock.MagicMock does not mock __truediv__

2014-03-19 Thread Johannes Baiter
Changes by Johannes Baiter johannes.bai...@gmail.com: Added file: http://bugs.python.org/file34515/mock_truediv_with_tests.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20968

[issue20968] mock.MagicMock does not mock __truediv__

2014-03-18 Thread Johannes Baiter
New submission from Johannes Baiter: It seems that when creating a MagicMock the magic '__truediv__' method is not replaced with a mock: import mock foo = mock.MagicMock() foo / 2 Traceback (most recent call last): File stdin, line 1, in module TypeError: unsupported operand type(s

[issue20968] mock.MagicMock does not mock __truediv__

2014-03-18 Thread Johannes Baiter
Johannes Baiter added the comment: Attached is a patch that fixes the issue for me. -- keywords: +patch Added file: http://bugs.python.org/file34490/mock_truediv.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20968

[issue20968] mock.MagicMock does not mock __truediv__

2014-03-18 Thread Johannes Baiter
Johannes Baiter added the comment: I just noticed that I put the magic method names in the wrong place in the patch. Attached is a fix that adds 'truediv' to the global 'numberics' variable, this way '__rtruediv__' and '__itruediv__' will be correctly mocked as well. -- Added file