question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Unable to debug test using Python extension

See original GitHub issue

Environment data

VSCode Version: 1.59.0 (user setup) Python Extension: Python v2021.8.1102490946 OS: Windows_NT x64 10.0.19043 Python version: 3.8.10 Virtual Env: Anaconda python language server: pylance

Expected behaviour

When debugging python tests, the test debugger loads correctly and hits the breakpoint.

Actual behaviour

When debugging python tests, the test debugger does not load correctly and breakpoint never gets hit.

Steps to reproduce:

  1. Navigate to the test using Testing option.
  2. Put a break point on the first line of the test.
  3. Click debug test option. The debugger never starts/loads. It keeps on showing the spinning icon.

Here is the gif,

python-test

Logs

Output for Python in the Output panel (ViewOutput, change the drop-down the upper-right of the Output panel to Python)

User belongs to experiment group 'pythonaacf'
User belongs to experiment group 'pythonJediLSP'
User belongs to experiment group 'pythonDiscoveryModuleWithoutWatcher'
User belongs to experiment group 'pythonTensorboardExperiment'
User belongs to experiment group 'pythonSurveyNotificationcf'
User belongs to experiment group 'PythonPyTorchProfiler'
User belongs to experiment group 'pythonDeprecatePythonPath'
User belongs to experiment group 'pythonSortEnvs'
Python interpreter path: ~\Anaconda3\envs\mounthood\python.exe
Starting Pylance language server.
> ~\Anaconda3\envs\mounthood\python.exe -m pylint --msg-template='{line},{column},{category},{symbol}:{msg}' --reports=n --output-format=text "c:\src\Mount Hood\tests\unit_tests\models\test_linear_regression.py"
cwd: c:\src\Mount Hood
> ~\Anaconda3\envs\mounthood\python.exe -m pylint --msg-template='{line},{column},{category},{symbol}:{msg}' --reports=n --output-format=text "c:\src\Mount Hood\tests\unit_tests\models\test_linear_regression.py"
cwd: c:\src\Mount Hood
> ~\Anaconda3\envs\mounthood\python.exe c:\Users\asif.prasla\.vscode\extensions\ms-python.python-2021.8.1102490946\pythonFiles\testing_tools\run_adapter.py discover pytest -- --rootdir "c:\src\Mount Hood" -s --cache-clear tests
cwd: c:\src\Mount Hood
##########Linting Output - pylint##########
************* Module tests.unit_tests.models.test_linear_regression
6,0,error,import-error:Unable to import 'regression_tests.framework.util'
8,0,error,import-error:Unable to import 'request.ara_request'
9,0,error,import-error:Unable to import 'asset_hierarchy.damage_mode'
10,0,error,import-error:Unable to import 'asset_hierarchy.cml_driver'
11,0,error,import-error:Unable to import 'visualization.pof_plotter'
12,0,error,import-error:Unable to import 'visualization.exxon_mobil_plotter'
13,0,error,import-error:Unable to import 'visualization.cml_report'
14,0,error,import-error:Unable to import 'visualization.lvc_plot'
15,0,error,import-error:Unable to import 'hierarchy_calculators.time_frames'
16,0,error,import-error:Unable to import 'hierarchy_calculators.reliawiki'
17,0,error,import-error:Unable to import 'pof_calculators.degradation_model'
18,0,error,import-error:Unable to import 'pof_calculators.inspection_effectiveness'
19,0,error,import-error:Unable to import 'util.types'
20,0,error,import-error:Unable to import 'config.mount_hood_runtime'
21,0,error,import-error:Unable to import 'plot'
134,0,refactor,too-many-locals:Too many local variables (16/15)

------------------------------------------------------------------

Your code has been rated at 4.86/10 (previous run: 4.86/10, +0.00)



> ~\Anaconda3\envs\mounthood\python.exe c:\Users\asif.prasla\.vscode\extensions\ms-python.python-2021.8.1102490946\pythonFiles\symbolProvider.py "c:\src\Mount Hood\tests\unit_tests\models\test_linear_regression.py"
> ~\Anaconda3\envs\mounthood\python.exe c:\Users\asif.prasla\.vscode\extensions\ms-python.python-2021.8.1102490946\pythonFiles\symbolProvider.py "c:\src\Mount Hood\tests\unit_tests\models\test_linear_regression.py"
> ~\Anaconda3\envs\mounthood\python.exe c:\Users\asif.prasla\.vscode\extensions\ms-python.python-2021.8.1102490946\pythonFiles\symbolProvider.py "c:\src\Mount Hood\tests\unit_tests\models\test_linear_regression.py"
> ~\Anaconda3\envs\mounthood\python.exe c:\Users\asif.prasla\.vscode\extensions\ms-python.python-2021.8.1102490946\pythonFiles\symbolProvider.py "c:\src\Mount Hood\tests\unit_tests\models\test_linear_regression.py"
> ~\Anaconda3\envs\mounthood\python.exe c:\Users\asif.prasla\.vscode\extensions\ms-python.python-2021.8.1102490946\pythonFiles\symbolProvider.py "c:\src\Mount Hood\tests\unit_tests\models\test_linear_regression.py"
> ~\Anaconda3\envs\mounthood\python.exe c:\Users\asif.prasla\.vscode\extensions\ms-python.python-2021.8.1102490946\pythonFiles\symbolProvider.py "c:\src\Mount Hood\tests\unit_tests\models\test_linear_regression.py"
Error 2021-08-06 08:23:25: Python: Failed to get symbols [SyntaxError: Unexpected end of JSON input
	at JSON.parse (<anonymous>)
	at c:\Users\asif.prasla\.vscode\extensions\ms-python.python-2021.8.1102490946\out\client\extension.js:9:111024
	at u.getSymbols (c:\Users\asif.prasla\.vscode\extensions\ms-python.python-2021.8.1102490946\out\client\extension.js:59:648491)
	at processTicksAndRejections (internal/process/task_queues.js:93:5)
	at async u.provideDocumentSymbols (c:\Users\asif.prasla\.vscode\extensions\ms-python.python-2021.8.1102490946\out\client\extension.js:59:647844)
	at async l.findSymbol (c:\Users\asif.prasla\.vscode\extensions\ms-python.python-2021.8.1102490946\out\client\extension.js:59:644900)
	at async f.navigateTo (c:\Users\asif.prasla\.vscode\extensions\ms-python.python-2021.8.1102490946\out\client\extension.js:59:643319)]
Error 2021-08-06 08:23:25: Symbol information not found [Error: Symbol information not found
	at l.findSymbol (c:\Users\asif.prasla\.vscode\extensions\ms-python.python-2021.8.1102490946\out\client\extension.js:59:645049)
	at processTicksAndRejections (internal/process/task_queues.js:93:5)
	at async f.navigateTo (c:\Users\asif.prasla\.vscode\extensions\ms-python.python-2021.8.1102490946\out\client\extension.js:59:643319)]
Error 2021-08-06 08:23:25: Unable to navigate to test function [Error: Test Function not found
	at f.navigateTo (c:\Users\asif.prasla\.vscode\extensions\ms-python.python-2021.8.1102490946\out\client\extension.js:59:643665)
	at processTicksAndRejections (internal/process/task_queues.js:93:5)]
Error 2021-08-06 08:23:25: Python: Failed to get symbols [SyntaxError: Unexpected end of JSON input
	at JSON.parse (<anonymous>)
	at c:\Users\asif.prasla\.vscode\extensions\ms-python.python-2021.8.1102490946\out\client\extension.js:9:111024
	at u.getSymbols (c:\Users\asif.prasla\.vscode\extensions\ms-python.python-2021.8.1102490946\out\client\extension.js:59:648491)
	at processTicksAndRejections (internal/process/task_queues.js:93:5)
	at async u.provideDocumentSymbols (c:\Users\asif.prasla\.vscode\extensions\ms-python.python-2021.8.1102490946\out\client\extension.js:59:647844)
	at async l.findSymbol (c:\Users\asif.prasla\.vscode\extensions\ms-python.python-2021.8.1102490946\out\client\extension.js:59:644900)
	at async f.navigateTo (c:\Users\asif.prasla\.vscode\extensions\ms-python.python-2021.8.1102490946\out\client\extension.js:59:643319)]
Error 2021-08-06 08:23:25: Symbol information not found [Error: Symbol information not found
	at l.findSymbol (c:\Users\asif.prasla\.vscode\extensions\ms-python.python-2021.8.1102490946\out\client\extension.js:59:645049)
	at processTicksAndRejections (internal/process/task_queues.js:93:5)
	at async f.navigateTo (c:\Users\asif.prasla\.vscode\extensions\ms-python.python-2021.8.1102490946\out\client\extension.js:59:643319)]
Error 2021-08-06 08:23:25: Unable to navigate to test function [Error: Test Function not found
	at f.navigateTo (c:\Users\asif.prasla\.vscode\extensions\ms-python.python-2021.8.1102490946\out\client\extension.js:59:643665)
	at processTicksAndRejections (internal/process/task_queues.js:93:5)]```

</p>
</details>

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:8 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
asiprascommented, Aug 13, 2021

I am not able to reproduce the issues that I mentioned earlier. I am closing this issue.

1reaction
asiprascommented, Aug 11, 2021

@kimadeline, I re-installed the python extension latest version v2021.8.1105858891 so that I could reproduce the issue I encountered before. However now I cannot reproduce the issue at all. I tried to reproduce it several times but I could not using latest python extension (before I could reproduce it quite frequently as you can see in gifs I posted above)

I will keep an watch on this today to see if I encounter this issue again.

Thanks for your help!!!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Testing Python in Visual Studio Code
Test : Debug Test at Cursor - Launches the debugger only for the method where you have your cursor focused on the editor....
Read more >
VS Code Debugger not working for python - Microsoft Q&A
Any troubleshooting tips. It seems when I do Run->"start Debugging' no command comes to terminal. Any VS Code log file that I can...
Read more >
Why is the Python test debugger not stopping on a bug?
I've just started using the tests functionality in the Python extension. I want to debug my test however when I hit the debug...
Read more >
Testing Extensions with Python — kit-manual 104.0 ...
You can use VSCode to attach a python debugger. Look into omni.kit.debug.python extension.toml for more settings, and check the FAQ section for ......
Read more >
unittest — Unit testing framework — Python 3.11.1 ...
Note that in order to test something, we use one of the assert*() methods provided by the TestCase base class. If the test...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found