Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Debugging unittest tests doesn't work #88

Closed

Comments

@DonJayamanne
Copy link

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

@DonJayamanne
Copy link
Author

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

@DonJayamanne
Copy link
Author

From @yRefl3x on March 14, 2017 9:56

@syagev I just tried reloading the window before debugging as you suggested. The test actually runs, but it doesn't debug. The breakpoint just changes to a grey circle for a short time but execution isn't stopped. The test just runs like when choosing "Run Tests".

@DonJayamanne
Copy link
Author

From @alexwhittemore on March 29, 2017 17:14

Confirmed, but I can't try "reload window" to solve it, because "discovering tests" has stopped completing for me.

@DonJayamanne
Copy link
Author

Closing in favor of #89 (partial import of issue)

@lock lock bot locked as resolved and limited conversation to collaborators Jul 13, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.