Skip to content

Create new event loop as fallback behaviour. #5753

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

paul-ollis
Copy link
Contributor

The method App.push_screen tries to create a Future using asyncio.get_running_loop(). If this raises a RuntimeError it simply invokes Future(), 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.

  • [n/a ] Docstrings on all new or modified functions / classes
  • [n/a ] Updated documentation
  • [n/a ] Updated CHANGELOG.md (where appropriate)

The method App.push_screen tries to create a Future using
`asyncio.get_running_loop()`. If this raises a RuntimeError it simply
invokes `Future()`, 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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant