Skip to content

Reuse existing event loop if one is already running #546

Closed Answered by martinkirch
medihack asked this question in Q&A
Discussion options

You must be logged in to vote

Hello,
I've encountered the same case, it was actually caused by playwright-pytest as exposed in microsoft/playwright-pytest#240 (this discussion was also submitted as microsoft/playwright-pytest#167). On the pytest-asyncio side, reimplementing the event_loop fixture is deprecated since #587 .

Now we have another solution: switching to pytest-playwright-asyncio. That implies updating existing tests to import from playwright.async_api, which also requires adding many async/await and putting all tests in the same loop (at least because Playwright's Browser is a session-wide fixture that tries to access the event loop... but setting asyncio_default_fixture_loop_scope = "session" was not enou…

Replies: 3 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@seifertm
Comment options

Answer selected by seifertm
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants
Converted from issue

This discussion was converted from issue #543 on May 16, 2023 05:40.