[Python] In a uv-created venv, the VS Code Integrated Debugger is not activating when clicking...

Discussão em 'Python' iniciado por Stack, Abril 10, 2025.

  1. Stack

    Stack Membro Participativo

    I am migrating a Django project from Pipenv to uv.

    My development environment is a VS Code Dev Container. Everything worked as expected when using Pipenv.

    I have a problem where the integrated debugger will not activate when I attempt to debug pytest unit tests.

    I set a breakpoint in the unit test, and clicked "Debug Test". The test runs, but the debugger is never activated.

    Test Results: Finished running tests!

    Debug Console: shows what I'd expect from running a pytest unit test.

    Python: Select Interpreter is set to my virtual environment's python.

    I have debugpy installed.

    I tried to manually get the debugger to activate.

    In one python session:

    >>> import debugpy; debugpy.listen(5678); debugpy.wait_for_client()
    ('127.0.0.1', 5678)


    another python session:

    uv run python -m pytest src/nexxus/tests/test_views.py::TestLegacyClientView::test_legacy_client_view_returns_active_servers


    The test runs, but the debugger is never activated.

    I am using:

    • Visual Studio Code 1.99.0
    • Python 3.11.2
    • debugpy 1.8.13

    Any help would be appreciated.

    Thanks.

    EDIT:

    It is one of these options from the pytest.ini that is breaking things

    [pytest]
    # Test coverage options
    addopts =
    --cov=.
    --cov-branch
    --cov-fail-under=75
    --cov-report=html
    --cov-report=term-missing
    --import-mode=importlib

    Continue reading...

Compartilhe esta Página