[Python] vscode - unit test discovery and running done differently

Discussão em 'Python' iniciado por Stack, Maio 31, 2025.

  1. Stack

    Stack Membro Participativo

    so in this case I cannot use the unit test framework, I have to do something else

    I have two sets of unit tests. Set (A) are normal pure python, unit test framework unit tests for various portions (modules) in my application. - These are easy, VSCODE unit test just works nicely :)

    Set (B) is a problem - this are test cases that are used to test the application as a whole. I have a sub-directory called: "test cases" - and under that I have large list of test case subdirectories. ie: testcases/foo, and testcases/bar, and testcases/dogs, and testcases/cats. Which test cases get run depends on other variables (ie: Shell Variables, the host machine type and other things)

    Basically each subdirectory - ie: the "dogs" directory tests the application when dealing with dogs, and the cats directory tests the application when dealing with "cats" - there are about 30 of these different configurations

    Another example is some tests require a specific equipment or development boards to be attached to the computer, which may or may not be present, ie: "machine(A) has a blue pill board, machine(B) has the red pill board - I have about 30 different boards.

    So the first question is: How can I get VSCODE unit test to discover and add" this list of additional tests to the VSCODE GUI menu. Again, it is not pyunittest - that is all of the "type A" tests, I am talking about the TYPE B tests.

    Second question: How do I tell the test framework the list of "command lines" to run for each test. Can I create a json file of some sort?

    Third question Bonus - The application is a python application. It would be great to be able to launch each of the type B tests using the python debugger.

    So in the end I have a mixture of "py-unit-test" items and a set of non-py-unit test items that I want to run from the VSOCODE test beaker menu.

    Continue reading...

Compartilhe esta Página