Skip to content
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

Unable to restart test debugger #20520

Closed
zjwilliams20 opened this issue Jan 17, 2023 · 5 comments
Closed

Unable to restart test debugger #20520

zjwilliams20 opened this issue Jan 17, 2023 · 5 comments
Assignees
Labels
area-testing bug Issue identified by VS Code Team member as probable bug info-needed Issue requires more information from poster

Comments

@zjwilliams20
Copy link

Type: Bug

Behaviour

Expected vs. Actual

When debugging unittests, I'd like to be able to restart the debugger.

Steps to reproduce:

  1. Create a file named test.py with the following content:
#!/usr/bin/env python

import unittest


class Test(unittest.TestCase):
    def test_me(self):
        pass
        self.assertTrue(True)


if __name__ == "__main__":
    unittest.main()
  1. Run Python: Configure Tests to use unittest at . with test*.py.
  2. Create a breakpoint in line 9.
  3. Debug the test either using the Testing tab or right click the icon on line.
  4. Restart the test.

Seems like #19030 and #17636 could be related.

Diagnostic data

  • Python version (& distribution if applicable, e.g. Anaconda): 3.10.4
  • Type of virtual environment used (e.g. conda, venv, virtualenv, etc.): Pyenv
  • 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"

formatting
• provider: "black"

testing
• unittestArgs: "<placeholder>"
• unittestEnabled: true

Extension version: 2022.20.2
VS Code version: Code 1.74.3 (97dec172d3256f8ca4bfb2143f3f76b503ca0534, 2023-01-09T16:59:02.252Z)
OS version: Windows_NT x64 10.0.19043
Modes:
Sandboxed: No
Remote OS version: Linux x64 5.15.79.1-microsoft-standard-WSL2
Remote OS version: Linux x64 5.15.79.1-microsoft-standard-WSL2

System Info
Item Value
CPUs Intel(R) Core(TM) i7-8850H CPU @ 2.60GHz (12 x 2592)
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
skia_renderer: enabled_on
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: disabled_off
Load (avg) undefined
Memory (System) 63.78GB (48.12GB free)
Process Argv --crash-reporter-id 3515b736-1f7c-4358-b41b-322311caf5fa
Screen Reader no
VM 19%
Item Value
Remote WSL: Ubuntu
OS Linux x64 5.15.79.1-microsoft-standard-WSL2
CPUs Intel(R) Core(TM) i7-8850H CPU @ 2.60GHz (12 x 2591)
Memory (System) 31.24GB (29.28GB free)
VM 0%
Item Value
Remote WSL: Ubuntu
OS Linux x64 5.15.79.1-microsoft-standard-WSL2
CPUs Intel(R) Core(TM) i7-8850H CPU @ 2.60GHz (12 x 2591)
Memory (System) 31.24GB (29.28GB free)
VM 0%
A/B Experiments
vsliv368cf:30146710
vsreu685:30147344
python383:30185418
vspor879:30202332
vspor708:30202333
vspor363:30204092
vslsvsres303:30308271
pythonvspyl392:30443607
vserr242cf:30382550
pythontb:30283811
vsjup518:30340749
pythonptprofiler:30281270
vshan820:30294714
vstes263:30335439
vscoreces:30445986
pythondataviewer:30285071
vscod805cf:30301675
binariesv615:30325510
bridge0708:30335490
bridge0723:30353136
cmake_vspar411:30581797
vsaa593cf:30376535
pythonvs932:30410667
cppdebug:30492333
vsclangdf:30486550
c4g48928:30535728
dsvsc012:30540252
azure-dev_surveyone:30548225
pyindex848:30577860
nodejswelcome1:30587005
282f8724:30602487
f6dab269:30613381
fim-prod:30623723
a9j8j154:30646983
vscsbc:30628655

@github-actions github-actions bot added the triage-needed Needs assignment to the proper sub-team label Jan 17, 2023
@zjwilliams20
Copy link
Author

zjwilliams20 commented Jan 17, 2023

Also relevant - debug console traceback:

Traceback (most recent call last):
  File "/home/zjw/.pyenv/versions/3.10.4/lib/python3.10/runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/home/zjw/.pyenv/versions/3.10.4/lib/python3.10/runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "/home/zjw/.vscode-server/extensions/ms-python.python-2022.20.2/pythonFiles/lib/python/debugpy/adapter/../../debugpy/launcher/../../debugpy/__main__.py", line 39, in <module>
    cli.main()
  File "/home/zjw/.vscode-server/extensions/ms-python.python-2022.20.2/pythonFiles/lib/python/debugpy/adapter/../../debugpy/launcher/../../debugpy/../debugpy/server/cli.py", line 430, in main
    run()
  File "/home/zjw/.vscode-server/extensions/ms-python.python-2022.20.2/pythonFiles/lib/python/debugpy/adapter/../../debugpy/launcher/../../debugpy/../debugpy/server/cli.py", line 284, in run_file
    runpy.run_path(target, run_name="__main__")
  File "/home/zjw/.vscode-server/extensions/ms-python.python-2022.20.2/pythonFiles/lib/python/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_runpy.py", line 321, in run_path
    return _run_module_code(code, init_globals, run_name,
  File "/home/zjw/.vscode-server/extensions/ms-python.python-2022.20.2/pythonFiles/lib/python/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_runpy.py", line 135, in _run_module_code

I consistently get this error in the Remote Extension Host logs:

2023-01-17 12:36:36.226 [error] TypeError: Cannot read properties of undefined (reading 'toString')
	at c.onCloseSocket (/home/zjw/.vscode-server/extensions/ms-python.python-2022.20.2/out/client/extension.js:2:738410)
	at Socket.<anonymous> (/home/zjw/.vscode-server/extensions/ms-python.python-2022.20.2/out/client/extension.js:2:737743)
	at Socket.emit (node:events:526:28)
	at TCP.<anonymous> (node:net:687:12)

When hitting restart, I see this get logged to Python:

DAP Server launched with command: /home/zjw/.pyenv/versions/3.10.4/bin/python /home/zjw/.vscode-server/extensions/ms-python.python-2022.20.2/pythonFiles/lib/python/debugpy/adapter

@eleanorjboyd
Copy link
Member

Hello! We are currently working on a fix for this- I apologies for the lack of response while we have been doing so. Thanks

@eleanorjboyd eleanorjboyd added bug Issue identified by VS Code Team member as probable bug area-testing labels Jan 31, 2023
@eleanorjboyd
Copy link
Member

Hello! We have just finished our testing rewrite and are beginning the roll out to users. If you are able, it would be very helpful to know if your issue still exists on the rewrite, I have tried this myself with the rewrite and it has worked! To try it yourself, you need to be on the most recent release of the Python extension and add this setting to your users settings.json "python.experiments.optInto": ["pythonTestAdapter"].

You can confirm you have the rewrite enabled by setting "python.analysis.logLevel": "Trace", in your user settings then check for Experiment 'pythonTestAdapter' is active in your python logs. (might need a reload and to set vscode log levels to trace too via the command palette)

Let me know if the rewrite fixes your issue. Thanks!

@github-actions github-actions bot added the info-needed Issue requires more information from poster label Jul 7, 2023
@eleanorjboyd eleanorjboyd removed the triage-needed Needs assignment to the proper sub-team label Jul 10, 2023
@zjwilliams20
Copy link
Author

Hey @eleanorjboyd, this seems to have resolved the issue after I got onto the pre-release version and did a reload + cleared python cache. Thanks!

@eleanorjboyd
Copy link
Member

Great! Thanks for testing it out- happy coding!

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 11, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-testing bug Issue identified by VS Code Team member as probable bug info-needed Issue requires more information from poster
Projects
None yet
Development

No branches or pull requests

2 participants