Skip to content

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
1 participant