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.

Debugger won't step over or into code

See original GitHub issue

Environment data

  • VS Code version: 1.22.2
  • Extension version (available under the Extensions sidebar): 2018.4.0
  • OS and version: MacOS X High Sierra
  • Python version (& distribution if applicable, e.g. Anaconda): 3.6.5 homebrew installed
  • Type of virtual environment used (N/A | venv | virtualenv | conda | …): venv
  • Relevant/affected Python packages and their versions: pytest?

Actual behavior

When I set a breakpoint in a unit test, and run “debug test”, the debugger pauses correctly on the breakpoint, but I can’t step into or over using the buttons in the GUI. Whenever I press either button, the debugger next breaks at testlauncher.py on sys.exit().

The test does run to completion. Whilst at the breakpoint, the debugger works otherwise, e.g. I can see locals, use the console, etc.

Python and pytest are both set to the binaries in my venv. Linting (flake8) and running of individual tests are both working.

    "python.pythonPath": "/Users/maraspeli/Build/Python/jira-metrics/bin/python",
    "python.linting.enabled": true,
    "python.linting.flake8Enabled": true,
    "python.linting.flake8Path": "/Users/maraspeli/Build/Python/jira-metrics/bin/flake8",
    "python.unitTest.pyTestEnabled": true,
    "python.unitTest.pyTestPath": "/Users/maraspeli/Build/Python/jira-metrics/bin/pytest",

I get almost the same behaviour if I create and use a launch configuration like this instead of the built-in “debug test” launcher:

        {
            "name": "Python: Tests",
            "type": "python",
            "request": "launch",
            "pythonPath": "${config:python.pythonPath}",
            "program": "python",
            "module": "pytest",
            "args": [
                "-v",
            ],
            "debugOptions": [
                "RedirectOutput"
            ]
        }

The only difference here is that I don’t get paused again at sys.exit(), it just finishes the test run.

Expected behavior

Step over and step into steps through the lines in the file.

Steps to reproduce:

  1. Set breakpoint
  2. Debug a test
  3. Attempt to step over or into a function

Logs

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

(nothing relevant)

Output from Console under the Developer Tools panel (toggle Developer Tools on under Help)

(nothing relevant)

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:18 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
Meidancommented, Sep 11, 2018

I get the same behavior even for regular python scripts, without any unit test package:

VS Code version: 1.27.1 Extension version (available under the Extensions sidebar): 2018.8.0 OS and version: Ubuntu 18.04 Python version (& distribution if applicable, e.g. Anaconda): 3.6.5 Type of virtual environment used (N/A | venv | virtualenv | conda | …): venv

1reaction
optiludecommented, May 10, 2018

One more data point: if I manually put another breakpoint (e.g. on line 7), the debuger does break there.

Basically, the best way to describe this behaviour is that both “step over (F10)” and “step into (F11)” are behaving like “continue (F5)”.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Visual Studio 2015: Debugger won't step over - Stack Overflow
My expectation is that when I click Step Over, it will go to the next line in the code. Am I misunderstanding how...
Read more >
Step through the program | IntelliJ IDEA Documentation
From the main menu, select Run | Debugging Actions | Step Out of Code Block. In the example, the action exits the for...
Read more >
Troubleshoot Breakpoints in the Visual Studio Debugger
If a source file has changed and the source no longer matches the code you're debugging, the debugger won't set breakpoints in the...
Read more >
Step Over or Step Into debugger problem
The problem is with debugging native C++ code, using Step Over (F10) lines of code. Step Into has similar problems. The debugger sporadically...
Read more >
Cannot Set Breakpoints or Step Through C/C++ Code
ANSWER · Source code is edited in debug mode. · Target was not updated with new image, before opening a new debug session....
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