Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Lib/test/test_asyncio/test_unix_events.py
Original file line number Diff line number Diff line change
Expand Up @@ -1824,8 +1824,6 @@ def test_get_child_watcher_after_set(self):
def test_get_child_watcher_thread(self):

def f():
policy.set_event_loop(policy.new_event_loop())

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.

What about:

def f():
    policy.set_event_loop(policy.new_event_loop())
    policy.set_child_watcher(asyncio.SafeChildWatcher())

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Changed to keep policy.set_event_loop() in a thread but setup the watcher in the main thread (it is crucial for the test).


self.assertIsInstance(policy.get_event_loop(),
asyncio.AbstractEventLoop)
watcher = policy.get_child_watcher()
Expand All @@ -1836,6 +1834,8 @@ def f():
policy.get_event_loop().close()

policy = self.create_policy()
policy.set_child_watcher(asyncio.SafeChildWatcher())
policy.set_event_loop(policy.new_event_loop())

th = threading.Thread(target=f)
th.start()
Expand Down