vscode-docs icon indicating copy to clipboard operation
vscode-docs copied to clipboard

Document how to run parallel tests with the Python extension

Open luabud opened this issue 7 years ago • 4 comments

@DonJayamanne to fill in with details

luabud avatar Apr 09 '19 21:04 luabud

@JoshuaPartlow Can we update here to include a subsection "Run tests in parallel" right below the "With PyTest, failed tests also appear in the Problems panel, where you can double-click on an issue to navigate directly to the test" paragraph?

This is how we support running tests in parallel with pytest:

  1. Open the integrated terminal and Install ‘pytest-xdist’ (more information can be found on their documentation):
$ pip install pytest-xdist
  1. Open the workspace settings.json file and add "-n","<number of CPUs>" to the pytest arguments list, specifying the number of CPUs you'd like to use. For example:
 "python.testing.pyTestArgs": ["-n", "4"] 

After that tests will be run in parallel

luabud avatar Jun 12 '19 17:06 luabud

Documented now with 0d9ff50.

JoshuaPartlow avatar Jun 13 '19 22:06 JoshuaPartlow

There's a bug where this is not working properly in some cases. Current workaround is to change ["-n", "4"] to ["-n 4"]. Can we update it in the docs like this for now?

luabud avatar Jun 22 '19 02:06 luabud

@luabud Might be best to open a new issue

DonJayamanne avatar Jun 22 '19 03:06 DonJayamanne