How do you get Nose2 tests to run on Visual Studio Code?

825 Views Asked by At

I'm trying to run tests in Visual Studio Code written for Nose 2. Neither the unittest nor nosetests options in the Python extension seem to be able to discover the tests correctly.

The test cases live in a number of python files in a subdirectory a couple levels down from root, for example:

(root)/test_suite/test_cases/[test script files]

How do I get Visual Studio Code to discover these tests? I've used PyCharm with this project in the past and it has no problem with test discovery.

1

There are 1 best solutions below

0
Brett Cannon On

You can specify arguments to nose (or unittest) via a setting, e.g. "python.unitTest.nosetestArgs", so you should be able to construct the appropriate arguments to discover the tests in that directory.