Dima Tisnek <dim...@gmail.com> added the comment:

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?

----------
nosy: +Dima.Tisnek

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue38857>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to