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
To run pytest tests using multiple processes, add ``-n=NUM`` or ``-n NUM`` on the command line, where NUM is the number of CPUs you want to use.
241
+
To run ``pytest`` with multiple processes, add ``-n=NUM``, ``-n NUM``, or ``-nNUM`` on the command line, where ``NUM`` is the number of CPUs you want to use.
@@ -269,18 +275,18 @@ The code above will leave your browser window open in case there's a failure. (p
269
275
<h3><imgsrc="https://seleniumbase.github.io/img/green_logo.png"title="SeleniumBase"width="32" /> Combinations of options:</h3>
270
276
271
277
🎛️ There are times when you'll want to combine various command-line options for added effect.
272
-
For instance, the multi-process option, ``-n=4``, can be customized by adding:
278
+
For instance, the multi-process option, ``-n8``, can be customized by adding:
273
279
``--dist=loadscope`` or ``--dist=loadfile`` to it.
274
280
Here's more info on that, as taken from [pytest-xdist](https://pypi.org/project/pytest-xdist/):
275
281
276
-
*``-n=4 --dist=loadscope``: Tests are grouped by module for test functions and by class for test methods. Groups are distributed to available workers as whole units. This guarantees that all tests in a group run in the same process. This can be useful if you have expensive module-level or class-level fixtures. Grouping by class takes priority over grouping by module.
282
+
*``-n8 --dist=loadscope``: Tests are grouped by module for test functions and by class for test methods. Groups are distributed to available workers as whole units. This guarantees that all tests in a group run in the same process. This can be useful if you have expensive module-level or class-level fixtures. Grouping by class takes priority over grouping by module.
277
283
278
-
*``-n=4 --dist=loadfile``: Tests are grouped by their containing file. Groups are distributed to available workers as whole units. This guarantees that all tests in a file run in the same worker.
284
+
*``-n8 --dist=loadfile``: Tests are grouped by their containing file. Groups are distributed to available workers as whole units. This guarantees that all tests in a file run in the same worker.
279
285
280
286
🎛️ You might also want to combine multiple options at once. For example:
The above not only runs tests in parallel processes, but it also tells tests in the same process to share the same browser session, runs the tests in headless mode, displays the full name of each test on a separate line, creates a realtime dashboard of the test results, and creates a full report after all tests complete.
0 commit comments