UnitTesting
UnitTesting copied to clipboard
How to run selected tests?
For example:
.
|__ tests/
|___a_tests.py
|___b_tests.py
a_tests.py
class Tests():
def test_a_test():
print("a")
def test_b_test():
print("b")
b_tests.py
class Tests():
def test_c_test():
print("a")
def test_d_test():
print("b")
Can I set a setting like:
{
"tests_dir" : "package_manager",
"pattern" : "*tests.py",
"async": false,
"deferred": true,
"verbosity": 1,
"capture_console": false,
"reload_package_on_testing": true,
"show_reload_progress": true,
"output": null,
"selected_test":
[
"test_b_test",
"test_c_test",
]
}
If selected_tests is empty or non existent, then all tests are run. Otherwise, only the listed tests are run.
There are no options to run only a specific testcase or specific test in a testcase, but here is a#n option to run only a selected file.
This option would be setting the "pattern" : "test*.py", to the path of the desired file?
Yap, you could use that option or the command UnitTesting: Test Current File.