Skip to content
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

Fix failing tests, including in ofrak-core-dev docker with Python3.11 #572

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
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
5 changes: 4 additions & 1 deletion ofrak_core/ofrak/ofrak_context.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,10 @@ async def run_async(self, func: Callable[["OFRAKContext", Any], Awaitable[None]]

# TODO: Typehints here do not properly accept functions with variable args
def run(self, func: Callable[["OFRAKContext", Any], Awaitable[None]], *args):
asyncio.get_event_loop().run_until_complete(self.run_async(func, *args))
# If we run this function multiple time and try using the default loop,
# the first test will delete the loop at the end of the run,
# and the 2nd call, unless we create a new asyncio loop.
asyncio.new_event_loop().run_until_complete(self.run_async(func, *args))

def _setup(self):
"""Discover common OFRAK services and components."""
Expand Down
2 changes: 1 addition & 1 deletion ofrak_io/ofrak_io/batch_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ async def get_result(self, request: Request) -> Result:
current_batch.add_request(request)
# Gives self._handler_loop_task a chance to raise its errors
done, _ = await asyncio.wait(
(current_batch.result(request), self._handler_loop_task),
(asyncio.ensure_future(current_batch.result(request)), self._handler_loop_task),
return_when=asyncio.FIRST_COMPLETED,
)
return next(iter(done)).result()
Expand Down
Loading