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
249 stars 30 forks source link

Splitting takes too long #48

Closed ma-sadeghi closed 2 years ago

ma-sadeghi commented 2 years ago

I just noticed that the splitting part takes too long (~1 min for my case). Is this expected? To reproduce, clone porespy, cd to porespy folder, and run the following command:

pytest test/ --splits 3 --group 1 --durations-path test/fixtures/.test_durations_unit
jerry-git commented 2 years ago

It's not pytest-split, it's the test collection which is slow in that project 🙂 I assume there are some super heavy fixtures or such? Screenshot 2022-03-13 at 14 12 27

jerry-git commented 2 years ago

The problem with porespy project is that it runs all the integration tests during collection as those are not wrapped into functions (i.e. those are not tests but scripts which run when the module is loaded). This is evident if you run e.g. pytest test/integration 🙂

Screenshot 2022-03-13 at 14 35 36

ma-sadeghi commented 2 years ago

Thank you so much for your super helpful reply! I just wrapped them in a few functions, and sure enough, the test collection is almost instant!