Command Line Interface Options

--force-reruns
Description:

Force specified number of reruns, irrespective of the number passed to pytest markers.

Type:

Integer

Default:

Not set (must be provided)

Example:
pytest --force-reruns 5
--only-rerun
Description:

Specify regex patterns for errors to rerun. Use this option multiple times to accumulate a list of regexes.

Type:

String (repeatable)

Default:

None

Example:
pytest --only-rerun AssertionError --only-rerun ValueError
--reruns
Description:

The number of times to rerun failing tests.

Type:

Integer

Default:

Not set (must be provided)

Example:
pytest --reruns 5
--reruns-delay
Description:

Delay in seconds between reruns.

Type:

Float

Default:

Not set (must be provided)

Example:
pytest --reruns 5 --reruns-delay 1
--rerun-except
Description:

Specify regex patterns for errors to exclude from reruns. Use this option multiple times to accumulate a list of regexes.

Type:

String (repeatable)

Default:

None

Example:
pytest --reruns 5 --rerun-except AssertionError --rerun-except OSError
--fail-on-flaky
Description:

If set, the test run will fail with exit code 7 if a flaky test passes on rerun.

Type:

Boolean flag

Default:

False

Example:
pytest --fail-on-flaky