Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from

Conversation

graingert
Copy link
Contributor

@graingert graingert commented Jul 21, 2022

…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-bot bedevere-bot added tests Tests in the Lib/test dir awaiting review labels Jul 21, 2022
@graingert graingert force-pushed the backport-834bd5d-3.10 branch from 9035b28 to 4b59f79 Compare July 21, 2022 17:59
@serhiy-storchaka serhiy-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
with Runner(loop_factory=asyncio.new_event_loop) as runner:
self.assertIsNone(runner.run(execute()))
Copy link
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
Contributor Author

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
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

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

@graingert graingert force-pushed the backport-834bd5d-3.10 branch from 4b59f79 to ca48762 Compare July 21, 2022 18:36
@graingert
Copy link
Contributor Author

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

@graingert graingert closed this Jul 23, 2022
@graingert graingert deleted the backport-834bd5d-3.10 branch July 23, 2022 01:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting review skip news tests Tests in the Lib/test dir
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants