-
Notifications
You must be signed in to change notification settings - Fork 30
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
Add ability to selectively not shuffle tests by using markers #575
Conversation
Some feedback would be greatly appreciated, especially if your vision on this feature is different. But having a way to disable shuffling only on required tests, while still leaning on the power of this plugin, would be a big plus for us. Romel |
pytest-order can already fix the order of tests, and it applies after pytest-randomly. There’s even a documented section on using the two together: https://pytest-order.readthedocs.io/en/latest/other_plugins.html#pytest-randomly I’ll add a docs section here about it, rather than merge an extra feature. |
Documentation added in #577. Btw I’m not against ever adding such a marker, if pytest-order isn’t suitable. But for now I would prefer to avoid expanding the surface area of pytest-randomly, especially when "fixed order tests" are what you’re trying to avoid. Thanks! |
Hi Adam, First off, thank you for taking the time to respond. |
Can you explain your situation a bit more? It sounds like you don’t intend to fix the inter-test dependencies ever? I’ve not seen a good reason for that before. |
Sure, We're using pytest to test a system closely connected to multiple cloud services. Due to the nature of the aforementioned system, some of the tests have costly setups and tend to be complex. A specific example (and the reason we want this functionality in pytest-randomly): For ease of monitoring and debugging we want to split the test into 6 separate tests. test_1[param_2] pytest-randomly + pytest-order would produce a result somewhere along the following example: test_2[param_2] The idea of using incremental tests is far from optimal, but i think it's the best option currently available to us, given the project specifics. |
A new marker
randomly_dont_reorganize
allows for disabling shuffling for select classes or modules.Note: Due to how the plugin works, disabling shuffling only works for entire classes or modules, not for individual functions (including parametrized tests)
Edit: Resolves #319