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 <rep...@bugs.python.org>
<http://bugs.python.org/issue29229>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to