cpython icon indicating copy to clipboard operation
cpython copied to clipboard

gh-96030: IsolatedAsyncioTestCase: don't create asyncio runner for skipped tests

Open tiran opened this issue 3 years ago • 3 comments

  • Issue: gh-96030

tiran avatar Aug 16 '22 18:08 tiran

This is an interesting approach, and I would prefer a code that overrides methods like _callSetUp() over the code that overrides run(), but there are problems with current code. I think that simpler #96033 should fix the original issue.

serhiy-storchaka avatar Aug 16 '22 20:08 serhiy-storchaka

My approach addresses the fact that the current code does too much when a test is skipped.

Let's merge your simple fix to unblock main and somebody else can take over my PR fix the code properly.

tiran avatar Aug 16 '22 20:08 tiran

How does this compare to #96033? It seems that is meant to fix the same issue.

gvanrossum avatar Aug 16 '22 21:08 gvanrossum

This PR appears doomed. @tiran want to just close it?

gvanrossum avatar Aug 17 '22 15:08 gvanrossum

The original issue was fixed, and it is a proper solution.

The code can be made more "elegant" if use the abstarct idea of this PR. I tried to implement it, but the simple and clear implementation of it free from the flaws of this PR suffered from two other issues:

  1. It breaks the case when doCleanup() is called in tesrDown(). This case is not covered by IsolatedAsyncioTestCase, but it happens with non-asynchronous tests, and it can happen with third party asynchronous tests,
  2. It creates a reference loop, which make the problem of cleaning up of abandoned IsolatedAsyncioTestCase instance worse.

It is possible to fix these two issues also, but the resulting code is far from "elegant". So for now I'm happy with the current code.

serhiy-storchaka avatar Jul 26 '23 07:07 serhiy-storchaka

So for now I'm happy with the current code.

So this issue is good to close?

itamaro avatar Jul 26 '23 15:07 itamaro

Closing per Serhiy's recommendation.

gvanrossum avatar Jul 26 '23 15:07 gvanrossum