profile
viewpoint

Ask questions"justMyCode" does not enable third party library debugging

<!-- Please search existing issues to avoid creating duplicates. -->

Environment data

  • VS Code version: 1.43.3
  • OS and version: macOS Catalina 10.15.3
  • Python version: Python 3.6
  • Relevant/affected Python packages and their versions: unittest
  • Value of the python.languageServer setting: 0.5.31.0 Setup launch.json
 {
            "name": "Debug: Tests",
            "type": "python",
            "request": "test",
            "justMyCode": false,
},

settings.json

{
    "python.linting.enabled": true,
    "python.linting.pylintEnabled": true,
    "python.testing.unittestArgs": [
        "-v",
        "-s",
        "/Users/tahazaidi/my_files/work_vocinity/agent-builder/tests",
        "-p",
        "test*.py"
    ],    
    "python.testing.pytestEnabled": false,
    "python.testing.nosetestsEnabled": false,
    "python.testing.unittestEnabled": true,
    "python.analysis.symbolsHierarchyDepthLimit": 20,
    "python.pythonPath": ".venv/bin/python3.6"
}

Test Case

class TestInitialAction(TestCase):
    def test_mytest(self):
        agent = train(
            domain='tests/project/config/domain.yml',
            config='tests/project/config/config.yml',
            training_files='tests/project/data'
        )

Expected behaviour

After stepping in the train function the debugger should take you to the definition of the function

Actual behaviour

Does not step into the function. Does not debug the third party code. Behaves like justMyCode is true

Steps to reproduce:

  1. Create a sample test case with usage of third party library function
  2. Discover Tests
  3. Add a breakpoint inside the function defintion or exactly on the method call
  4. Select the Debug: Tests launch config from the Debugging explorer
  5. Debug the test using the Run Test | Debug Test menu that appears on each test OR use the Python: Debug Test Method command
  6. Step into function

Logs

Frame skipped from debugging during step-in.
Note: may have been skipped because of "justMyCode" option (default == true). Try setting "justMyCode": false in the debug configuration (e.g., launch.json).

Additional Details

Changing the launch.json to (adding the console option)

        {
            "name": "Debug: Tests",
            "type": "python",
            "request": "test",
            "console": "integratedTerminal",
            "justMyCode": false,
        }

The terminal outputs an error. The debug breakpoints do not trigger even for my own code

env PTVSD_LAUNCHER_PORT=51104 /Users/tahazaidi/my_files/work_vocinity/agent-builder/.venv/bin/python3.6 /Users/tahazaidi/.vscode/extensions/ms-python.python-2020.2.64397/pythonFiles/lib/python/new_ptvsd/no_wheels/ptvsd/launcher /Users/tahazaidi/.vscode/extensions/ms-python.python-2020.2.64397/pythonFiles/visualstudio_py_testlauncher.py --us=/Users/tahazaidi/my_files/work_vocinity/agent-builder/tests --up=test*.py --uvInt=2 --result-port=51101 -ttest_initial_action.TestInitialAction --testFile=/Users/tahazaidi/my_files/work_vocinity/agent-builder/tests/test_initial_action.py 
zsh: no matches found: --up=test*.py

If you remove the Debug: Tests launch object the above issue disappers but justMyCode still doesn't change the behavior.

microsoft/vscode-python

Answer questions karthiknadig

@tahamr83 See if the solution recommended here helps https://github.com/microsoft/ptvsd/issues/2103

useful!
source:https://uonfu.com/
answerer
Karthik Nadig karthiknadig @Microsoft Redmond Developer at Microsoft, working on VS Code Python and Python Debugger.
Github User Rank List