Message285146
| Author |
jason.curtis |
| Recipients |
jason.curtis |
| Date |
2017年01月10日.19:22:08 |
| SpamBayes Score |
-1.0 |
| Marked as misclassified |
Yes |
| Message-id |
<1484076129.07.0.522749594718.issue29229@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
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
``` |
|
History
|
|---|
| Date |
User |
Action |
Args |
| 2017年01月10日 19:22:09 | jason.curtis | set | recipients:
+ jason.curtis |
| 2017年01月10日 19:22:09 | jason.curtis | set | messageid: <1484076129.07.0.522749594718.issue29229@psf.upfronthosting.co.za> |
| 2017年01月10日 19:22:09 | jason.curtis | link | issue29229 messages |
| 2017年01月10日 19:22:08 | jason.curtis | create |
|