Fix failing tests, including in ofrak-core-dev docker with Python3.11 #572
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
One sentence summary of this PR (This should go in the CHANGELOG!)
Fixed two tests - one was failing starting with Python 3.11 and another is probably an intermittent failure that existed for a while.
Link to Related Issue(s)
#352
Please describe the changes in your request.
ofrak_io/ofrak_io/batch_manager.py
- starting with Python3.11, coroutines cannot be passed to asyncio.wait directly, and have to be wrapped in a future or a task. This wraps it usingasyncio.ensure_future
OFRAK.run
usedasyncio.new_event_loop().run_until_complete
which meant that the first time it was executed, it will delete the loop at the end of the run, and will then fail with a RuntimeException on any further calls. This means that during testing, if two tests using this function happened to be assigned to the same runner process, then the 2nd test would fail. Changed it by creating a separate asyncio loop for each call, so that it does not mess with the default loop.Anyone you think should look at this, specifically?
@whyitfor