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 Petter S
Recipients Petter S, asvetlov, njs, pdxjohnny, r.david.murray, yselivanov, zach.ware
Date 2018-03-08.13:13:01
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1520514781.95.0.467229070634.issue32972@psf.upfronthosting.co.za>
In-reply-to
Content
> No, it shouldn't break them if you wrap async methods carefully.
> Here's a metaclass that I wrote recently doing just that

That code does not seem to work for me:
https://gist.github.com/PetterS/f684095a09fd1d8164a4d8b28ce3932d
I get "RuntimeWarning: coroutine 'test_async_with_mock' was never awaited"

@mock.patch needs to work correctly for test methods.

>> I'm really not seeing what a separate class buys you.
> I already mentioned in my previous comments that adding async support to unittest.TestCase would require us to add a metaclass to it, which is potentially a backwards incompatible change.

No, unittest.TestCase can handle this, as demonstrated by two PRs in this bug. This would not change the behavior of existing (working) code.
History
Date User Action Args
2018-03-08 13:13:01Petter Ssetrecipients: + Petter S, r.david.murray, njs, asvetlov, zach.ware, yselivanov, pdxjohnny
2018-03-08 13:13:01Petter Ssetmessageid: <1520514781.95.0.467229070634.issue32972@psf.upfronthosting.co.za>
2018-03-08 13:13:01Petter Slinkissue32972 messages
2018-03-08 13:13:01Petter Screate