Skip to content

[3.10] gh-95010: Fix asyncio GenericWatcherTests.test_create_subprocess_fail… - #95099

Closed
graingert wants to merge 2 commits into
python:3.10from
graingert:backport-834bd5d-3.10
Closed

[3.10] gh-95010: Fix asyncio GenericWatcherTests.test_create_subprocess_fail…#95099
graingert wants to merge 2 commits into
python:3.10from
graingert:backport-834bd5d-3.10

Conversation

@graingert

@graingertgraingert commented Jul 21, 2022

Copy link
Copy Markdown
Contributor

…s_with_inactive_watcher (GH-95009)

The test was never run, because it was missing the TestCase class.
The test failed because the wrong attribute was patched.
(cherry picked from commit 834bd5d)

Co-authored-by: Thomas Grainger tagrain@gmail.com

…s_fails_with_inactive_watcher (pythonGH-95009)
The test was never run, because it was missing the TestCase class.
The test failed because the wrong attribute was patched.
(cherry picked from commit 834bd5d)
Co-authored-by: Thomas Grainger <tagrain@gmail.com>
@bedevere-botbedevere-bot added tests Tests in the Lib/test dir awaiting review labels Jul 21, 2022
@graingert
graingertforce-pushed the backport-834bd5d-3.10 branch from 9035b28 to 4b59f79CompareJuly 21, 2022 17:59
@serhiy-storchakaserhiy-storchaka changed the title gh-95010: Fix asyncio GenericWatcherTests.test_create_subprocess_fail…[3.10] gh-95010: Fix asyncio GenericWatcherTests.test_create_subprocess_fail…Jul 21, 2022
Comment on lines 864 to 868

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not just use self.loop.run_until_complete() as in other tests?

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the GenericWatcherTests don't have a self.loop, and SubprocessWatcherMixin (which sets self.loop) calls get_event_loop_policy().attach_loop and this test case is testing what happens when attach_loop isn't called

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Many classes set self.loop. For this test you can inherit from test_utils.TestCase and add

defsetUp(self):
super().setUp()
self.loop=asyncio.new_event_loop()
self.set_event_loop(self.loop)

@graingert
graingertforce-pushed the backport-834bd5d-3.10 branch from 4b59f79 to ca48762CompareJuly 21, 2022 18:36
@graingert

Copy link
Copy Markdown
ContributorAuthor

I think I'll try to hurdle this hurdle when backporting #94184

@graingert
graingert deleted the backport-834bd5d-3.10 branch July 23, 2022 01:47
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting reviewskip newstestsTests in the Lib/test dir

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@graingert@serhiy-storchaka@bedevere-bot