[issue26600] MagickMock __str__ sometimes returns MagickMock instead of str

2021-02-22 Thread Uosiu
Stanisław Skonieczny (Uosiu) added the comment: When you just create a magick mock and then call `__str__` on it, it never throws an exception and always return a string. But... when you create a magick mock and then call `__str__` from two threads concurrently, one of them will raise an

[issue26600] MagickMock __str__ sometimes returns MagickMock instead of str

2021-02-22 Thread Irit Katriel
Irit Katriel added the comment: Why is this only relevant to multiple thread? -- ___ Python tracker ___ ___ Python-bugs-list

[issue26600] MagickMock __str__ sometimes returns MagickMock instead of str

2021-02-22 Thread Irit Katriel
Change by Irit Katriel : -- status: closed -> open ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue26600] MagickMock __str__ sometimes returns MagickMock instead of str

2021-02-22 Thread Uosiu
Stanisław Skonieczny (Uosiu) added the comment: However there is still nothing in the docs that you have to mock `__str__` by yourself when using mock object with multiple threads. Otherwise calling `__str__` may result with raising exception if you are unlucky. Stanisław Skonieczny On Wed,

[issue26600] MagickMock __str__ sometimes returns MagickMock instead of str

2021-02-17 Thread Irit Katriel
Irit Katriel added the comment: The documentation has examples how to set up a mock's __str__. https://docs.python.org/3/library/unittest.mock.html -- nosy: +iritkatriel resolution: -> not a bug stage: -> resolved status: open -> closed ___

[issue26600] MagickMock __str__ sometimes returns MagickMock instead of str

2016-08-15 Thread Yoichi Nakayama
Yoichi Nakayama added the comment: It is not a bug of MagicMock. It is a problem of the sample program. Calling str to mock object cause not only read access, it also write to related objects. So there is a race condition. -- nosy: +Yoichi Nakayama

[issue26600] MagickMock __str__ sometimes returns MagickMock instead of str

2016-03-21 Thread SilentGhost
Changes by SilentGhost : -- nosy: +michael.foord, pitrou versions: +Python 3.6 -Python 3.2, Python 3.3, Python 3.4 ___ Python tracker

[issue26600] MagickMock __str__ sometimes returns MagickMock instead of str

2016-03-21 Thread Uosiu
New submission from Stanisław Skonieczny (Uosiu): This bug results in raising TypeError: __str__ returned non-string (type MagicMock) Following program can reproduce it: ``` from threading import Thread from mock.mock import MagicMock def main(): mocks = [MagicMock() for _ in