You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Extension version (available under the Extensions sidebar): v2021.9.1191016588
OS and version: Windows 10.0.19041
Python version (& distribution if applicable, e.g. Anaconda): Python 3.9.5 64-bit
Type of virtual environment used (N/A | venv | virtualenv | conda | ...): venv
Relevant/affected Python packages and their versions: unittest of python 3.9.5
Value of the python.languageServer setting: Pylance v2021.9.0
Expected behaviour
When the Test: Run All Tests routine is started, either from the Command Palette or the testing sidebar, the tests should be finished in the same amount of time as running the python -m unittest command.
Actual behaviour
When the Test: Run All Tests routine is started, either from the Command Palette or the testing sidebar, it takes much longer as running the python -m unittest command. Running my particular test suite takes 1.2s while running the tests using the vscode extension takes at least several seconds. From the logs I cannot find a duration of running the tests from the extension. It is also difficult to time the tests since I'm experiencing also the #17282 bug.
From the log output I can see that running the tests from the extension triggers each test individually, so that the unittest module needs to be started for every test. This is probably what makes the execution much slower. See the Logs section below for the log output.
Steps to reproduce:
Create a test suite that consists of multiple tests.
Run the test suite using the python -m unittest command and note the time spent.
Run the tests from the tests sidebar or Test: Run All Tests routine
Compare duration of test execution
Logs
Output for Python Test Log in the Output panel (View→Output, change the drop-down the upper-right of the Output panel to Python Test Log)
test_xxxx (test_xxxx.xx) ... ok
----------------------------------------------------------------------
Ran 1 test in 0.000s
OK
test_xxxxxxx (test_xxxx.xxx) ... ok
----------------------------------------------------------------------
Ran 1 test in 0.000s
OK
test_xxx (test_xxx.xxx) ... ok
----------------------------------------------------------------------
Ran 1 test in 0.000s
OK
I want to add to the above that previously (before v1.60.0) the tests were running equally fast for both methods of running the tests. Also, the Python Test Log output showed that all tests were run in one go using the unittest module.
I tested the new build, which improves the speed by a bit. Now tests are performed per test python file. This could be still improved by testing the whole suite (all test files) at once.
Activity
pvenderbosch commentedon Sep 7, 2021
I want to add to the above that previously (before v1.60.0) the tests were running equally fast for both methods of running the tests. Also, the
Python Test Logoutput showed that all tests were run in one go using theunittestmodule.pvenderbosch commentedon Sep 9, 2021
I tested the new build, which improves the speed by a bit. Now tests are performed per test python file. This could be still improved by testing the whole suite (all test files) at once.