jerry-git / pytest-split

Pytest plugin which splits the test suite to equally sized "sub suites" based on test execution time.
https://jerry-git.github.io/pytest-split/
MIT License
241 stars 29 forks source link

compatibility with pytest-dependency #75

Open Mystorius opened 1 year ago

Mystorius commented 1 year ago

Hi,

first: thank you for the cool tool, it really helps with faster CI pipelines :)

My request: can you make the split algorithm take pytest dependencys into account? We have same test that depend on other test to run first. Currently pytest splits theses into different groups which will result in the tests failing.

jerry-git commented 1 year ago

Hi! Interesting use case 🤔 How do you ensure they run in correct order without using pytest-split? Are the tests which depend on each other within the same module or even within the same class?

If you could move the dependencies into fixtures, that would probably solve the issue without needing to change how pytest-split behaves. If that's out of question, I guess one option could be to introduce some CLI options to pytest-split for not splitting test modules / classes.

jerry-git commented 1 year ago

Sorry, I think I misread initially. So, you are basically asking if pytest-split could be made compatible with https://pypi.org/project/pytest-dependency/?

Mystorius commented 1 year ago

Yes, was just about to post that we use pytest-dependency But I didn't know that pytest-split is compatible with fixtures already. Maybe it would be worth it to refactor our tests into fixtures then as pytest-dependency seems to be out of date anyways.

jerry-git commented 1 year ago

Maybe it would be worth it to refactor our tests into fixtures

Great! I hope it works out nicely for you 🙂

zeevikn-oe commented 1 month ago

@jerry-git Hi. First, thanks for this pytest addition. It looks awesome. You mention here that using fixture can help group tests together (which is what currently blocking us from splitting our tests), but I did not find any reference to it in the repo. Internal reasons requires some tests to be grouped together (ordering in the group can be random) I'd be happy if you could point/elaborate how we can use fixtures to force tests into the same group. Thanks