<html><head><meta http-equiv="Content-Type" content="text/html; charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><div class=""><span style="font-family: Menlo;" class="">Hi everyone and good morning to some of you,</span></div><div class=""><span style="font-family: Menlo;" class=""><br class=""></span></div><div class=""><span style="font-family: Menlo;" class="">Since asyncio and the async/await syntax are both part of Python, I think</span></div><div class=""><span style="font-family: Menlo;" class="">that we should extend TestCase to support it.  The simplest solution that</span></div><div class=""><span style="font-family: Menlo;" class="">I can think of is to </span><span style="font-family: Menlo;" class="">create unittest.AsyncTestCase sub-class with the</span></div><div class=""><span style="font-family: Menlo;" class="">following extensions:</span></div><div class=""><span style="font-family: Menlo;" class=""><br class=""></span></div><div class=""><span style="font-family: Menlo;" class=""> - create a new event </span><font face="Menlo" class="">loop</font><span style="font-family: Menlo;" class=""> and install it in AsyncTestCase.run</span></div><div class=""><span style="font-family: Menlo;" class=""> - make it possible for setUp, tearDown, and test methods to be async</span></div><div class=""><span style="font-family: Menlo;" class="">   by calling asyncio.iscoroutinefunction</span></div><div class=""><span style="font-family: Menlo;" class=""><br class=""></span></div><div class=""><span style="font-family: Menlo;" class="">I wrote my own in a local test before noticing that Martin Richard had</span></div><div class=""><span style="font-family: Menlo;" class="">already written and published asynctest [1].  Since then I found the</span></div><div class=""><span style="font-family: Menlo;" class="">following projects as well:</span></div><div class=""><span style="font-family: Menlo;" class=""><br class=""></span></div><div class=""><span style="font-family: Menlo;" class=""> - </span><font face="Menlo" class=""><a href="https://github.com/kwarunek/aiounittest" class="">https://github.com/kwarunek/aiounittest</a></font></div><div class=""><font face="Menlo" class=""> - <a href="https://github.com/pytest-dev/pytest-asyncio" class="">https://github.com/pytest-dev/pytest-asyncio</a></font></div><div class=""><br class=""></div><div class=""><font face="Menlo" class="">I think that the community as a whole would benefit from basic support in</font></div><div class=""><font face="Menlo" class="">unittest for async/await test "user methods".  I am personally fond of the</font></div><div class=""><font face="Menlo" class="">approach of extending unittest.TestCase in asynctest [2] </font><span style="font-family: Menlo;" class="">over some of the</span></div><div class=""><span style="font-family: Menlo;" class="">other approaches.</span></div><div class=""><font face="Menlo" class=""><br class=""></font></div><div class=""><font face="Menlo" class="">Is this something that we want in our Standard Library?</font></div><div class=""><font face="Menlo" class=""><br class=""></font></div><div class=""><font face="Menlo" class="">- dave</font></div><div class=""><font face="Menlo" class="">--</font></div><div class=""><span style="font-family: Menlo;" class="">[1]: </span><font face="Menlo" class=""><a href="https://github.com/Martiusweb/asynctest" class="">https://github.com/Martiusweb/asynctest</a></font></div><div class=""><font face="Menlo" class="">[2]: </font><a href="https://github.com/Martiusweb/asynctest/blob/master/asynctest/case.py" style="font-family: Menlo;" class="">https://github.com/Martiusweb/asynctest/blob/master/asynctest/case.py</a></div></body></html>