Message362115
I think this deserves discussion :)
On one hand, it's a welcome change, on another it's kind of a regression.
Up until 3.8, our tests used to look like this:
---
# code under test
async def foo():
return await bar()
# test
async def helper(value):
return value
async def test_foo():
with patch("bar", return_value=helper(42)):
assert await foo() == 42
---
I feel that the default class `patch()` uses for `new` has crept in too quietly in 3.8.
At the same time, `helper` was only used because there was no `AsyncMock`.
(or at times, a 3rd party library, `asynctest` was used).
So, on one hand, it's a bit of a regression, but on the other, looking ahead, I would really like `unittest.mock` to do the right thing.
Can we have it both ways? If not, what way is a better way? |
|
Date |
User |
Action |
Args |
2020-02-17 02:57:16 | Dima.Tisnek | set | recipients:
+ Dima.Tisnek, asvetlov, fried, lisroach |
2020-02-17 02:57:16 | Dima.Tisnek | set | messageid: <1581908236.72.0.381380569432.issue38857@roundup.psfhosted.org> |
2020-02-17 02:57:16 | Dima.Tisnek | link | issue38857 messages |
2020-02-17 02:57:16 | Dima.Tisnek | create | |
|