diff options
author | Xtreak <tir.karthi@gmail.com> | 2019-09-11 11:02:14 (GMT) |
---|---|---|
committer | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2019-09-11 11:02:14 (GMT) |
commit | 6a9fd66f6e4445a418c43c92585b9e06d76df4b1 (patch) | |
tree | 459ed4f1a0ff60e91ae01a83678218a4f8a422aa /Doc/whatsnew | |
parent | 7a6873cdb1f496447ac5d57ae457eacbb56b7972 (diff) | |
download | cpython-6a9fd66f6e4445a418c43c92585b9e06d76df4b1.zip cpython-6a9fd66f6e4445a418c43c92585b9e06d76df4b1.tar.gz cpython-6a9fd66f6e4445a418c43c92585b9e06d76df4b1.tar.bz2 |
bpo-32972: Document IsolatedAsyncioTestCase of unittest module (GH-15878)
* 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
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 ---- |