Skip to content

Experimental debugger wont stop on breakpoints when debugging testcases in async-await code #2111

@andersea

Description

@andersea

Environment data

  • VS Code version: 1.25.0
  • Extension version (available under the Extensions sidebar): 2018.6.0 (20 June 2018)
  • OS and version: Kubuntu 17.10, Linux 4.13.0-46
  • Python version (& distribution if applicable, e.g. Anaconda): Python 3.6.3
  • Type of virtual environment used (N/A | venv | virtualenv | conda | ...): pipenv
  • Relevant/affected Python packages and their versions: unittest, pytest, trio, asyncio

Actual behavior

Running a test on an async function running, the debugger won't stop on breakpoints inside async functions. Tried with both unittest and pytest. Originally tested with trio event loop but the problem also occurs with asyncio, so it is not event loop specific.

It looks as if the execution stops, but you don't get an indication at all, no yellow line on the breakpoint, no stack trace, no variable inspection and shortly after the test seems to crash.

billede

Expected behavior

Debugger stops on breakpoint inside async function.

Steps to reproduce:

Test code using pytest:

def test_content(response):
    """Sample pytest test function with the pytest fixture as an argument."""
    # from bs4 import BeautifulSoup
    # assert 'GitHub' in BeautifulSoup(response.content).title.string
    async def test_something_async():
        assert 1 == 2

    trio.run(test_something_async)

I set the breakpoint on the assert line, like in the screenshot above.

Logs

Output from Console under the Developer Tools panel (toggle Developer Tools on under Help)

============================= test session starts ==============================
platform linux -- Python 3.6.3, pytest-3.6.3, py-1.5.4, pluggy-0.6.0
rootdir: /home/andersa/python/realtime_data, inifile: setup.cfg

collecting 1 item                                                              
collected 1 item                                                               
tests/test_realtime_data.py 

Metadata

Metadata

Assignees

Labels

area-debuggingbugIssue identified by VS Code Team member as probable bug

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions