[New-bugs-announce] [issue29229] incompatible: unittest.mock.sentinel and multiprocessing.Pool.map()
Jason Curtis
report at bugs.python.org
Tue Jan 10 14:22:09 EST 2017
New submission from Jason Curtis:
When a sentinel object from unittest.mock.sentinel is passed through a multiprocessing.Pool.map, I expect it to still be comparable.
As a user, I'd like to be able to write a unit test using sentinels on my unparallelized code, and then see that the test still passes after I parallelize the code using multiprocessing, so that I can make use of sentinels in regression testing.
Example:
```
from unittest import mock
import multiprocessing
def identity(x):
return x
with multiprocessing.Pool() as pool:
multiprocessed = list(pool.map(identity, [mock.sentinel.foo]))
assert identity(mock.sentinel.foo) == mock.sentinel.foo # Passes
assert multiprocessed[0] == mock.sentinel.foo # Fails
```
----------
components: Library (Lib)
messages: 285146
nosy: Jason Curtis
priority: normal
severity: normal
status: open
title: incompatible: unittest.mock.sentinel and multiprocessing.Pool.map()
type: behavior
versions: Python 3.4
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue29229>
_______________________________________
More information about the New-bugs-announce
mailing list