This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author yselivanov
Recipients Liran Nuna, asvetlov, yselivanov
Date 2018-06-20.21:25:50
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1529529950.66.0.56676864532.issue33918@psf.upfronthosting.co.za>
In-reply-to
Content
> Imagine the context manager is mock.patch used in testing and you want to run two tests in "parallel", each with a different mocked method. mock.patch isn't aware of `await` so patching will be incorrect.

That's still doable with contextvars. You just need a custom mock-like object (or library) that stores its settings/state in a context variable.

Now, the "mock" module doesn't provide this functionality out of the box, but I hope that somebody will come up with a new mock library that will work that way (or with a new mock primitive) after 3.7.0 is released.

Adding __pause__ and __resume__ was considered in PEP 521, and it was decided that the actual implementation will be too slow and complex.  It's very unlikely that PEP 521 is ever accepted.
History
Date User Action Args
2018-06-20 21:25:50yselivanovsetrecipients: + yselivanov, asvetlov, Liran Nuna
2018-06-20 21:25:50yselivanovsetmessageid: <1529529950.66.0.56676864532.issue33918@psf.upfronthosting.co.za>
2018-06-20 21:25:50yselivanovlinkissue33918 messages
2018-06-20 21:25:50yselivanovcreate