Karthikeyan Singaravelan <tir.kar...@gmail.com> added the comment:
I tried using AsyncioDocTestRunner that inherits from DocTestRunner and most of the current DocTestRunner is synchronous and the execution happens in __run that seems to cause problem due to name mangling inheriting and changing it. Also python -m doctest by default uses testmod/testfile that use DocTestRunner so I thought to change DocTestRunner would be simpler and existing code can use added doctest flag without changing runner. To be little more clear by each line I meant each example. So in below "async with session.get(url) as resp:\n text = await resp.text()" counts as a single example whose code object is evaluated in asyncio.run which I said as per line by mistake. >>> async with session.get(url) as resp: ... text = await resp.text() Your concerns are reasonable about asyncio.run per example seem to be over kill and might not work in few cases. I also didn't think about trio. I will look into those. Thanks for the pointers. ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue37006> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com