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

random_seeder option to define entry points to use #497

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

ascillitoe
Copy link

This PR is just an idea for restricting the use of random_seeder entry points (which might be) defined in 3rd party deps. It is not complete (no docs, tests etc).

Taking the example in #495, assume there is one entry point defined in a user's own package:

[options.entry_points]
pytest_randomly.random_seeder =
    my_seeder = my_package.utils._random:set_seed

and another entry point defined in a 3rd party dependency:

[options.entry_points]
pytest_randomly.random_seeder =
    another_seeder = third_party_package.utils._random:set_seed

At present, both seeders are run. This might be a problem in some cases, as the owner of my_package might not want another_seeder to run.

This PR is an incomplete idea to solve this by adding a new pytest_randomly option randomly-seeder to set the random_seeder entry points to use (similar to the pytest -p option). Usage would be:

pytest --randomly-seeder=my_seeder testing/test_notebooks.py

to run only my_seeder. If randomly-seeder is not given, the default would be not to use any custom seeder. IMO this might be better/safer than using all defined entry points by default...

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

Successfully merging this pull request may close these issues.

1 participant