vscode-python: Debugging unittest tests doesn't work

From @yRefl3x on March 6, 2017 11:11

Environment data

VS Code version: 1.10.1 Python Extension version: 0.5.9 Python Version: 2.7.5 OS and version: Windows 10

Actual behavior

After clicking on the “Debug Test” lens of a test method, debugging doesn’t start. “Running Tests” is displayed at the bottom of the VSCode window indefinitely.

Expected behavior

Debugging starts.

Steps to reproduce:

I have the following folder structure:

Issue
    cool_package
        __init__.py
        cool_module.py
    test
        __init__.py
        test_cool_module.py

cool_module.py

def foo(a, b):
    return a + b

test_cool_module.py

import unittest

from cool_package.cool_module import foo

class TestCoolModule(unittest.TestCase):
    def test_foo(self):
        res = foo(1, 2)
        self.assertEquals(res, 3)
  • Set a breakpoint at line res = foo(1, 2)
  • Click “Debug Test” in test method code lens

Settings

settings.json:

{
    "python.unitTest.unittestArgs": [
        "-v",
        "-s",
        "test",
        "-p",
        "test_*.py"
    ],
    "python.unitTest.unittestEnabled": true
}

Logs

Output from Python Test Log output panel

READY

Copied from original issue: DonJayamanne/pythonVSCode#797

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 27 (1 by maintainers)

Commits related to this issue

Most upvoted comments

I think I’m still seeing this issue. Trying to use the inline “Debug Tests” within a unit test module shows “Running Tests” in the status bar, but nothing happens.

  • VSCode 1.20.1 x64
  • Python 2018.1.0
  • Win 10

From @syagev on March 14, 2017 8:56

Same exact symptoms here. win10, python ext 0.6.0, VSC 1.10.2, Python 3.5.3

EDIT: “reload window” VSC command seems to solve this every time this happens