Open indigoviolet opened 3 years ago
@indigoviolet Thank you for the issue! If you don't run all tests, you can update your test settings to discover tests only in specific folders. For example, for unittest (see docs https://docs.python.org/3/library/unittest.html#cmdoption-unittest-discover-s)
"python.testing.unittestArgs": [
"-v",
"-s",
"./path/to/folder/you/are/working/with", <-- -s arg specifies a folder from which to discover tests
"-p",
"*test*.py"
],
or for pytest (see docs https://docs.pytest.org/en/6.2.x/usage.html#specifying-tests-selecting-tests)
"python.testing.pytestArgs": ["path/to/folder/you/are/working/with"]
Let me know if this helps.
That can help, but it's quite inconvenient to change that setting each time I'm going to switch buffers and work on a test in another file. What I'm looking/hoping for is a flag like "Reload tests only in saved buffers", and each time I save a buffer, we rediscover the tests in that file and update the corresponding node in the main test tree.
It not work for me, my settings.json is
{ "python.testing.unittestArgs": [ "-v", "-s", ".", "-p", "test*.py" ], "python.testing.pytestEnabled": false, "python.testing.nosetestsEnabled": false, "python.testing.unittestEnabled": true }
my test py are
test_a.py test_all_Commands.py test_AutomationTest.py test_BMC_Browser.py test_KVM.py test_Page_Element.py test_SSH_SCP.py
folder structure:
2021/08/21 11:12
and sidebar show as
@k870611 Have you tried changing -s
argument from .
to some subfolder, e.g. test_a
? Also, it'd help if you provide additional details, like how should your expected result look like?
like Python can put all the test in it py
but Test Explorer is list all the test (not like python is put at sub)
My folder structure is
Currently test discovery takes a long time, but the usual pattern is that I'm adding tests in one file. Is it possible to optimize the "reload" function to be incremental?