diff options
author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2019-09-11 11:17:14 (GMT) |
---|---|---|
committer | Andrew Svetlov <andrew.svetlov@gmail.com> | 2019-09-11 11:17:14 (GMT) |
commit | 0ba5dbd992d68d7df23396148ad55624200a1dbc (patch) | |
tree | 3beeef5037612b26c69306acdc404fa42d90ab8c /Doc/whatsnew | |
parent | 7acb22e6e9061f85988c0c6c5ee25ebdf2950841 (diff) | |
download | cpython-0ba5dbd992d68d7df23396148ad55624200a1dbc.zip cpython-0ba5dbd992d68d7df23396148ad55624200a1dbc.tar.gz cpython-0ba5dbd992d68d7df23396148ad55624200a1dbc.tar.bz2 |
bpo-32972: Document IsolatedAsyncioTestCase of unittest module (GH-15878) (GH-15918)
* Document `unittest.IsolatedAsyncioTestCase` API
* Add a simple example with respect to order of evaluation of setup and teardown calls.
https://bugs.python.org/issue32972
Automerge-Triggered-By: @asvetlov
(cherry picked from commit 6a9fd66f6e4445a418c43c92585b9e06d76df4b1)
Co-authored-by: Xtreak <tir.karthi@gmail.com>
Diffstat (limited to 'Doc/whatsnew')
-rw-r--r-- | Doc/whatsnew/3.8.rst | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/Doc/whatsnew/3.8.rst b/Doc/whatsnew/3.8.rst index 2b4eb63..07202ea 100644 --- a/Doc/whatsnew/3.8.rst +++ b/Doc/whatsnew/3.8.rst @@ -1111,6 +1111,32 @@ unittest * Several mock assert functions now also print a list of actual calls upon failure. (Contributed by Petter Strandmark in :issue:`35047`.) +* :mod:`unittest` module gained support for coroutines to be used as test cases + with :class:`unittest.IsolatedAsyncioTestCase`. + (Contributed by Andrew Svetlov in :issue:`32972`.) + + Example:: + + import unittest + + + class TestRequest(unittest.IsolatedAsyncioTestCase): + + async def asyncSetUp(self): + self.connection = await AsyncConnection() + + async def test_get(self): + response = await self.connection.get("https://example.com") + self.assertEqual(response.status_code, 200) + + async def asyncTearDown(self): + await self.connection.close() + + + if __name__ == "__main__": + unittest.main() + + venv ---- |