Skip to content

Commit

Permalink
Fix test failures
Browse files Browse the repository at this point in the history
- migrate away from deprecated get_event_loop
- try ignoring warnings due to unclosed _UnixSubprocessTransport not
being closed when subprocess is killed for some reason
  • Loading branch information
linkous8 committed Nov 22, 2023
1 parent 7ecf686 commit f7c7162
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
8 changes: 7 additions & 1 deletion servo/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -2056,7 +2056,13 @@ def run_async(future: Union[asyncio.Future, asyncio.Task, Awaitable]) -> Any:
Raises:
Exception: Any exception raised during execution of the future.
"""
return asyncio.get_event_loop().run_until_complete(future)
try:
return asyncio.get_running_loop().run_until_complete(future)
except RuntimeError as e:
if str(e) == "no running event loop":
return asyncio.run(future)
else:
raise


def print_table(table, headers) -> None:
Expand Down
1 change: 1 addition & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ filterwarnings =
ignore: unclosed resource <UVProcessTransport .*:ResourceWarning
ignore: subprocess \d+ is still running:ResourceWarning
ignore: unclosed transport <_UnixSubprocessTransport .*:ResourceWarning
ignore: Event loop is closed:RuntimeError
ignore:The --rsyncdir command line argument and rsyncdirs config variable are deprecated.:DeprecationWarning
ignore: Deprecated call to `pkg_resources\.declare_namespace.*:DeprecationWarning
ignore: pkg_resources is deprecated as an API:DeprecationWarning
Expand Down

0 comments on commit f7c7162

Please sign in to comment.