Skip to content

Pytest debug breakpoints not hit using python 3.11 #1289

Description

@morybc

Type: Bug

Behaviour

Running a pytest in debug mode no longer stops at breakpoints when using Python 3.11 (works in Python3.10).

Expected vs. Actual

Pytest running in debug mode should stop on breakpoints. Instead it doesn't and the following output logging is given:

[gw7] win32 Python 3.11.3 cwd: C:\Users\...
0.02s - Debugger warning: It seems that frozen modules are being used, which may
0.00s - make the debugger miss breakpoints. Please pass -Xfrozen_modules=off
0.00s - to python to disable frozen modules.

Have attempted to pass in this arg via a launch config - i.e.:

    {
      "name": "Python: Debug Tests",
      "type": "python",
      "pythonArgs": ["-Xfrozen_modules=off"],
      "request": "launch",
      "program": "${file}",
      "purpose": ["debug-test"],
      "console": "integratedTerminal",
      "justMyCode": false,
    }

but this does not make any difference.

Steps to reproduce:

  1. Set up a project with Python3.11 (my current version is 3.11.3)
  2. Run a pytest test in debug mode, with a breakpoint specified
  3. Breakpoint ignored

Diagnostic data

  • Python version (& distribution if applicable, e.g. Anaconda): 3.11.3
  • Type of virtual environment used (e.g. conda, venv, virtualenv, etc.): Poetry
  • Value of the python.languageServer setting: Default
Output for Python in the Output panel (ViewOutput, change the drop-down the upper-right of the Output panel to Python)

XXX

User Settings


languageServer: "Pylance"

linting
• mypyEnabled: true

formatting
• provider: "black"

testing
• pytestEnabled: true

Extension version: 2023.8.0
VS Code version: Code 1.78.0 (252e5463d60e63238250799aef7375787f68b4ee, 2023-05-03T20:09:00.748Z)
OS version: Windows_NT x64 10.0.19045
Modes:
Sandboxed: No

System Info
Item Value
CPUs 12th Gen Intel(R) Core(TM) i7-1265U (12 x 2688)
GPU Status 2d_canvas: enabled
canvas_oop_rasterization: disabled_off
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: enabled
Load (avg) undefined
Memory (System) 15.69GB (3.36GB free)
Process Argv --crash-reporter-id 406cbb39-75fb-4a50-827b-0de462815df9
Screen Reader no
VM 0%
A/B Experiments
vsliv368cf:30146710
vsreu685:30147344
python383cf:30185419
vspor879:30202332
vspor708:30202333
vspor363:30204092
vslsvsres303:30308271
vserr242:30382549
pythontb:30283811
vsjup518:30340749
pythonptprofiler:30281270
vshan820:30294714
vstes263cf:30335440
pythondataviewer:30285071
vscod805cf:30301675
binariesv615:30325510
bridge0708:30335490
bridge0723:30353136
cmake_vspar411:30581797
vsaa593cf:30376535
pythonvs932:30410667
cppdebug:30492333
vsclangdf:30486550
c4g48928:30535728
dsvsc012cf:30540253
pynewext54:30695312
azure-dev_surveyone:30548225
282f8724:30602487
pyind779:30671433
89544117:30613380
pythonsymbol12:30671437
showlangstatbar:30737416
azdwalk:30721579
pythonms35:30701012
pythonfmttext:30731395
pythoncmvfstrcf:30731970
fixshowwlkth:30730052
showsbindicator:30730056

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions