-
Notifications
You must be signed in to change notification settings - Fork 911
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
[BUG] Debugger fails with pytest #2031
Comments
Your attached code was not working, you can do this instead: import pytest
from playwright.async_api import async_playwright, Browser
import pytest_asyncio
@pytest_asyncio.fixture(scope="function")
async def browser():
async with async_playwright() as playwright:
# Use Firefox as the browser
browser = await playwright.firefox.launch(headless=False)
yield browser
await browser.close()
@pytest.mark.asyncio
async def test_playwright_with_firefox(browser: Browser):
page = await browser.new_page()
await page.goto("https://www.example.com")
assert "Example Domain" in await page.title()
await page.close() We discourage doing so tho, since we have an official pytest-playwright plugin which launches the browsers and contexts for you automatically: https://playwright.dev/python/docs/intro |
Yes sorry I tried to simpilify my code from my project, but with PDB debugger it's working fine, however PDB debugger only supports sync, so async api cannot be used with any debugger. |
I was able to reproduce it, with the following repro steps:
Expected: no deadlock I recommend filing it against https://github.com/microsoft/vscode-python instead, since this seems most likely not caused by us and they can debug it quicker. |
consider using PDB for debugging synchronous parts of your code and manually inserting print statements or logging for async code until a resolution is found for the freezing issue with the VSCode pytest debugger. Maybe consider testing outside of vscode |
I don't understand your point, you can literally write print statement to debug your code in VSCODE given current status but that's not what actual debugging means. You'd want to execute code as you're changing your breakpoint to figure out the problem. |
System info
Source code
Make a checkpoint in VSCode with pytest debugger, and when running the file, it runs file. but if you want to execute another function (like going to another url) inside the debugger terminal, it'll fail. the debugger will freeze.
Steps
Expected
[Describe expected behavior]
Actual
[Describe actual behavior]
The text was updated successfully, but these errors were encountered: