Breakpoints in Python code are ignored when I run “Debug Test” in VSCode

Whenever I run “Debug Test” (from either the testing pane or by right clicking on the margin left of the code and selecting it) it runs the test just fine but it ignores breakpoints.

I’ve configured the following section in launch.json for “Debug Test”:

        {
          "name": "Python: Debug Tests",
          "type": "debugpy",
          "request": "launch",
          "console": "integratedTerminal",
          "justMyCode": false,  // Set to false to step into external libraries if necessary
          "purpose": ["debug-test"],  // Enables this configuration for "Debug Test"
          "program": "${workspaceFolder}/backend/tests",
          "args": ["-m", "pytest", "--capture=no"]  // Run pytest with optional args (disable output capturing)
        }

I have the following settings.json:

{
    "python.testing.pytestArgs": [
        "backend/tests"
    ],
    "python.testing.unittestEnabled": false,
    "python.testing.pytestEnabled": true,
    
}

This is the output when I run “Debug Test”:

/usr/bin/env /home/rolf/.virtualenvs/marquee/bin/python /home/rolf/.vscode-server/extensions/ms-python.debugpy-2024.10.0-linux-x64/bundled/libs/debugpy/adapter/../../debugpy/launcher 35459 -- /home/rolf/.vscode-server/extensions/ms-python.python-2024.14.1-linux-x64/python_files/vscode_pytest/run_pytest_script.py --rootdir=/home/rolf/marquee --capture=no 
rolf@ubundev:~/marquee$  /usr/bin/env /home/rolf/.virtualenvs/marquee/bin/python /home/rolf/.vscode-server/extensions/ms-python.debugpy-2024.10.0-linux-x64/bundled/libs/debugpy/adapter/../../debugpy/launcher 35459 -- /home/rolf/.vscode-server/extensions/ms-python.python-2024.14.1-linux-x64/python_files/vscode_pytest/run_pytest_script.py --rootdir=/home/rolf/marquee --capture=no 
Received JSON data in run script
Running pytest with args: ['-p', 'vscode_pytest', '--rootdir=/home/rolf/marquee', '--capture=no', '/home/rolf/marquee/backend/tests/test_gs_movie_db.py::test_get_movies']
============================= test session starts ==============================
platform linux -- Python 3.11.6, pytest-8.3.2, pluggy-1.5.0
rootdir: /home/rolf/marquee
plugins: anyio-4.4.0
collected 1 item

backend/tests/test_gs_movie_db.py F

=================================== FAILURES ===================================

What follows is a bunch of failing tests that are beyond my breakpoint (so my breakpoint should have been triggered).

I don’t have “pytest-cov” installed which presence was mentioned as a possible culprit in another post.

I’ve tried testing wether the launch.json profile is being used by changing the args there and seeing if they also change in the execution log which doesn’t seem to be the case (the same parameters are still used). The settings from settings.json do seem to be being used.

Also, it’s possible to manually select a “Debug Test” profile in the testing section but it only ever shows one default profile to choose from even if I add more to the launch.json with the same “purpose”: “debug-test” (maybe that’s not how that works?).

I’ve also tried clearing both the Python and the Python Debugger cache and restarting but that doesn’t change anything (except having to reselect the right interpreter from my Python virtual env).

When I debug normally it works fine and all breakpoints that I expect to hit activate the debugger. This is the regular debugging profile:

        {
            "name": "Python: FastAPI with Uvicorn",
            "type": "debugpy",
            "request": "launch",
            "module": "backend.api",
            "cwd":"${workspaceFolder}",
            "console": "integratedTerminal",
            "env": {
              "PYTHONPATH": "${workspaceFolder}"
            },
            "justMyCode": true
          }

I’m using VSCode 1.93.1, Python extension v2024.14.1, Python Debugger extension v2024.10.0 (latest versions).

Another thing to note is that I’m using VSCode over an SSH session on a local VM.

2

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật