Skip to content

Commit 8b8767e

Browse files
committed
Update a ReadMe
1 parent 7fd9786 commit 8b8767e

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

help_docs/customizing_test_runs.md

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ pytest test_demo_site.py --demo
2020
pytest test_demo_site.py --headless
2121

2222
# Run tests multi-threaded using [n] threads
23-
pytest test_suite.py -n=4
23+
pytest test_suite.py -n4
2424

2525
# Reuse the browser session for all tests ("--rs")
2626
pytest test_suite.py --reuse-session
@@ -238,7 +238,13 @@ If you want to pass additional data from the command line to your tests, you can
238238

239239
<h3><img src="https://seleniumbase.github.io/img/green_logo.png" title="SeleniumBase" width="32" /> Running tests multithreaded:</h3>
240240

241-
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.
242+
243+
```bash
244+
pytest -n=8
245+
pytest -n 8
246+
pytest -n8
247+
```
242248

243249
<h3><img src="https://seleniumbase.github.io/img/green_logo.png" title="SeleniumBase" width="32" /> Retrying failing tests automatically:</h3>
244250

@@ -269,18 +275,18 @@ The code above will leave your browser window open in case there's a failure. (p
269275
<h3><img src="https://seleniumbase.github.io/img/green_logo.png" title="SeleniumBase" width="32" /> Combinations of options:</h3>
270276

271277
🎛️ 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:
273279
``--dist=loadscope`` or ``--dist=loadfile`` to it.
274280
Here's more info on that, as taken from [pytest-xdist](https://pypi.org/project/pytest-xdist/):
275281

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.
277283

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.
279285

280286
🎛️ You might also want to combine multiple options at once. For example:
281287

282288
```bash
283-
pytest --headless --rs -n=4 -v --dashboard --html=report.html
289+
pytest --headless -n8 --dashboard --html=report.html -v --rs --crumbs
284290
```
285291

286292
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

Comments
 (0)