[issue44730] unittest.mock.patch does not work as a decorator on generator functions

2021-07-23 Thread Gareth Williams
Change by Gareth Williams : -- keywords: +patch pull_requests: +25860 stage: -> patch review pull_request: https://github.com/python/cpython/pull/27315 ___ Python tracker ___

[issue44730] unittest.mock.patch does not work as a decorator on generator functions

2021-07-23 Thread Gareth Williams
New submission from Gareth Williams : unitest.mock.patch does not work well when applied as a decorator to a function which is a generator. It results in the function being changed from a generator function (co_flags 99) to a non-generator (co_flag 31) and the patch is not applied. [I have a