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

Automated testing of Shiny app combined with async calls throws error about being unable to close running event loop #42

Open
sebovzeoueb opened this issue Feb 19, 2025 · 0 comments
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@sebovzeoueb
Copy link
Collaborator

sebovzeoueb commented Feb 19, 2025

We have some tests using the end to end framework provided by Shiny for Python, which uses Playwright. However as a lot of our code is async, we also need to use pytest-asyncio. These two don't seem to play well together, and even adding in nest_asyncio, we still get an error during teardown even though the actual tests pass:

RuntimeError: Cannot close a running event loop

We have tried a few of the suggestions found around the internet but so far none of them have fixed the error. For now we have marked the Shiny tests to be skipped because we don't want errors in our test runs, however we do need to fix this at some point. If anyone wants to have a go, we would welcome contributions to attempt to fix this issue.

One path we haven't explored is using anyio instead of pytest-asyncio, we haven't investigated this solution yet so we're unsure of how valid it may be.

@sebovzeoueb sebovzeoueb added bug Something isn't working help wanted Extra attention is needed labels Feb 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

1 participant