Bluffton Python Dude
Bluffton Python Dude

Reputation: 103

Visual Studio Code - 'command python.runtests not found' what is this?

I'm using Visual Studio Code to develop a python project and when I select the option to run all unit tests, I get the following error: 'command 'python.runtests' not found

In my project I'm the unittest package and I have a settings.json file that has the following configuration (see below):

{

    "python.unitTest.unittestArgs": [ "-v","-s", ".//Test", "-p", "*_test.py" ],
    "python.unitTest.unittestEnabled": true,
    "python.unitTest.pyTestEnabled": false,
    "python.unitTest.nosetestsEnabled": false
}

All my unit tests classes are under a folder called Test folder.

Please help, thanks in advance.

Upvotes: 6

Views: 2481

Answers (2)

ncw
ncw

Reputation: 1733

You don't have to reinstall the Python extension. Instead, enable the Jedi Python Language Server:

{
    "python.languageServer": "Jedi",

    "python.unitTest.unittestArgs": ["-v", "-s", ".//Test", "-p", "*_test.py"],
    "python.unitTest.unittestEnabled": true,
    "python.unitTest.pyTestEnabled": false,
    "python.unitTest.nosetestsEnabled": false
}

Note that the setting python.jediEnabled has been removed in favor of the python.languageServer setting according to this post referring to this VSCode changelog.

Upvotes: 3

Robert
Robert

Reputation: 358

I just had the same problem, and it was common to all my Python workspaces

The solution for me was nice and simple though - simply uninstall the VSCode Python extension and then reinstall it.

Robert

Upvotes: 1

Related Questions