Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tests random order #16508

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

donaldsharp
Copy link
Member

Add the ability to the test suites to run the tests in a random order.

pip3 install pytest-random-order

sudo -E python3 -m pytest -s -vv -n --dist=loadfile --random-order=package

Consult the pytest-random-order module for further instructions.

You can achieve this now by installing pytest-random-order:

pip3 install pytest-random-order

Then running pytest with this:

python3 -m pytest --random-order=package -nauto --dist=loadfile

Tests will be run in a random order.

Signed-off-by: Donald Sharp <[email protected]>
I used sed to get the pytest changes in place, run black
to get the formatting right.

Signed-off-by: Donald Sharp <[email protected]>
@frrbot frrbot bot added documentation tests Topotests, make check, etc labels Jul 31, 2024
Copy link
Member

@ton31337 ton31337 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't we just add something like that? To avoid touching every test file we have.

[pytest]
...
random_order_disable = true

Even more, reading the manual I see:

From v1.0.0 onwards, this plugin no longer randomises tests by default. To enable randomisation, you have to run
pytest in one of the following ways:
pytest --random-order
pytest --random-order-bucket=<bucket_type>
pytest --random-order-seed=

So, this is not needed at all to disable the plugin in every file? Which version did you test?

Copy link

This pull request has conflicts, please resolve those before we can evaluate the pull request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants