Create new event loop as fallback behaviour. #5753
Open
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.
The method App.push_screen tries to create a Future using
asyncio.get_running_loop()
. If this raises a RuntimeError it simply invokesFuture()
, as a fallback, order to support some of the tests.When running tests using pytest-xdist it is possible for this fallback mechanism to fail and instead raise another RuntimeError when
Future()
tries to get the 'standard' event loop. This is a rare occurrence with the current tests' structure, but I have seen it a number of times.It is causes by a test that invokes App.run (which invokes asyncio.run) being executed before a test that depends on the aforementioned fallback mechanism. Both tests must be executed by the same pytest-xdist worker process.
Please review the following checklist.