Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

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.

like image 986
Bluffton Python Dude Avatar asked Oct 26 '17 01:10

Bluffton Python Dude


2 Answers

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.

like image 173
ncw Avatar answered Sep 23 '22 11:09

ncw


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

like image 43
Robert Avatar answered Sep 25 '22 11:09

Robert