-
Notifications
You must be signed in to change notification settings - Fork 32
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
Split results in 0 selected tests, which leads to failed GitHub action #95
Comments
Interesting! Probably not an open source repo as you didn't include a link to a GHA run? If it's private, could you share the durations file? The test names can be anonymised. I'd be mainly interested in seeing what kind of duration values there are. |
@jerry-git thanks for the quick reply. Indeed, the repo is not open source so I can't share the github action run. These were the different splits: And this was the durations file for that run: Most of the tests are fast, while there are only a few which take more than 5 seconds. Thank you! |
Thanks for the data! I think I know what’s up. So, there are a couple of tests which have 10+ seconds duration while around 500/608 tests take 0.01 seconds or less. If the splits (when split to 7) would be optimal, each group would take around 17.92 seconds to run if we’d run all the tests listed in tests_empty_split.txt. The duration based chunks algo basically takes tests into a single group until optimal time is reached (17.92 seconds in this case). Then it moves to fill the next group. The tests are looped in the same order in which pytest collects them (alphabetical order AFAIK). Same as code here: pytest-split/src/pytest_split/algorithms.py Lines 109 to 118 in c7a3272
I believe those longer tests coincidentally happen to be at the end of their groups. For example, the very first group could have 472 shorter tests with total execution time of just a hair lower than 17.92 seconds, then a test which takes 10+ seconds comes and gets still added to the group. The fact that the estimated runtime for that first group is notably longer than 17.92 seconds is not taken into account while filling the next groups. So, at the end, this leads to the last group not having tests at all. Here's a quickly hacked analysis of tests_empty_splits.txt:
If your test suite is robust enough to run the tests in semi random order, the best would be to use I’ll see how I could improve the splits with the duration based chunks algo. Taking into account the estimated total runtime for previous groups should be relatively low hanging fruit for improving the behaviour of the algorithm. |
Thanks for the support and the detailed explanation Jerry. Indeed our test suite can run in random order, as there are no dependencies between tests. We have changed the Moving forward, I believe this issue can be closed, unless you want to keep it open to track any change related to it. Once again, thank you. |
Hi @jerry-git . I encountered a similar issue. Perhaps an algorithm like the following. Though mainly the _get_minimum_split would be a more accurate way of determining the max duration for test suites with chunky tests.
|
Hi,
We have integrated
pytest-split
as part of our CI pipeline and noticed the following behaviour.We were running our tests in 7 splits, but after updating the
.test_durations
script (new tests being added), the 7th split did not select any test. This lead to a failed CI run since all the tests were deselected (see below).Any idea why this could happen?
We tried to create more splits after this error was raised (increased from 7 to 10) and everything worked fine.
We would like to understand why the 7th split did not select any test when
--splits 7
but everything worked well when--splits 10
.Thanks in advance. Your package has become very useful in speeding up our CICD pipelines.
The text was updated successfully, but these errors were encountered: