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.

Debugging unittest tests doesn't work

See original GitHub issue

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

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:27 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
thomsavagecommented, Feb 16, 2018

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
Read more comments on GitHub >

github_iconTop Results From Across the Web

Visual Studio - suddenly cannot debug tests - Stack Overflow
I tried to debug tests using Resharper 8 Unit Test Session window. The message in the result window was "Test wasn't run".
Read more >
Can't run or debug unit tests - Visual Studio Feedback
I'm using Visual Studio Community Edition 15.8.1 and I can't run or debug any unit tests. Every time I'm trying to run the...
Read more >
Debugging unit tests in VS 2012 doesn't work - MSDN
As my understanding, if we want to debug a unit test, we could debug it like the following steps. Right click a unit...
Read more >
MSTest Unit Testing does not work (or fails with error) with ...
+1 can't debug unit tests. They can be executed but not debugged. VS Professional 2017 (15.3.1) Re-sharper Ultimate (2017.1.3).
Read more >
Debugging Your Unit Test Suite in Python | Capital One
Python has a reputation as being a simple language to work in, but that doesn't always extend to the unit tests; some things...
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