This section outlines the details necessary to get you up and started with using the python unittest testing framework with Visual Studio Code.
Assign the value true
against the setting python.unitTest.unittestEnabled
as outlined here.
Ensure all other test frameworks have been disabled (i.e. have the value false
).
Test Discovery Pattern
The default pattern used to match test files is test*.py
.
This can be configured as follows:
"-p", "*_test.py"
) if not found (else alter it as follows): "python.unitTest.unittestArgs": [
"-p",
"*_test.py"
],
Note:
_test.p
to be treated as test files.Verbosity
The default verbosity is ‘v’.
This can be configured as follows:
"-v"
) if not found (else alter it as follows): "python.unitTest.unittestArgs": [
"-v"
],
"python.unitTest.unittestArgs": [
],
Start Directory
This is the directory to start the test discovery (defaults to the project/workspace root directory).
This can be configured as follows:
"-s", "./tests"
) if not found (else alter it as follows): "python.unitTest.unittestArgs": [
"-v",
"-s",
"./tests"
],
Note:
Fail Fast
Use this option to stop the test run on the first error or failure.
By default this is disabled, i.e. if a test fails the test run continues with other tests.
This can be configured as follows:
"-f"
) if not found (else alter it as follows): "python.unitTest.unittestArgs": [
"-v",
"-f"
],
Note:
This section outlines the details necessary to get you up and started with using the python unittest testing framework with Visual Studio Code.
Assign the value true
against the setting python.unitTest.unittestEnabled
as outlined here.
Ensure all other test frameworks have been disabled (i.e. have the value false
).
Test Discovery Pattern
The default pattern used to match test files is test*.py
.
This can be configured as follows:
"-p", "*_test.py"
) if not found (else alter it as follows): "python.unitTest.unittestArgs": [
"-p",
"*_test.py"
],
Note:
_test.p
to be treated as test files.Verbosity
The default verbosity is ‘v’.
This can be configured as follows:
"-v"
) if not found (else alter it as follows): "python.unitTest.unittestArgs": [
"-v"
],
"python.unitTest.unittestArgs": [
],
Start Directory
This is the directory to start the test discovery (defaults to the project/workspace root directory).
This can be configured as follows:
"-s", "./tests"
) if not found (else alter it as follows): "python.unitTest.unittestArgs": [
"-v",
"-s",
"./tests"
],
Note:
Fail Fast
Use this option to stop the test run on the first error or failure.
By default this is disabled, i.e. if a test fails the test run continues with other tests.
This can be configured as follows:
"-f"
) if not found (else alter it as follows): "python.unitTest.unittestArgs": [
"-v",
"-f"
],
Note: