Message212417
Sentinels lose their identity when they are pickled, meaning they are no longer equal to sentinel with the same name.
>>> from mock import sentinel
>>> import pickle
>>> sentinel.foo == sentinel.foo
True
>>> pickle.loads(pickle.dumps(sentinel.foo)) == sentinel.foo
False
I found this bug using Python 2.7.3 and python-mock 1.0.1. Since mock 1.0 is part of Python 3.3 and 3.4 it affects these versions (tested in 3.3.3).
This behavior is tricky to find out if encountered in tests and sentinels can not be used in tests of code which uses pickle and possibly other serializations. |
|
Date |
User |
Action |
Args |
2014-02-28 09:22:37 | Vlastimil.Zíma | set | recipients:
+ Vlastimil.Zíma |
2014-02-28 09:22:37 | Vlastimil.Zíma | set | messageid: <1393579357.22.0.503856996983.issue20804@psf.upfronthosting.co.za> |
2014-02-28 09:22:37 | Vlastimil.Zíma | link | issue20804 messages |
2014-02-28 09:22:36 | Vlastimil.Zíma | create | |
|