-
-
Notifications
You must be signed in to change notification settings - Fork 32.3k
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
Replace pytest-test-groups by custom tests splitter #114381
Conversation
c681aad
to
787040e
Compare
787040e
to
e17eb82
Compare
Co-authored-by: Martin Hjelmare <[email protected]> Co-authored-by: Paulus Schoutsen <[email protected]>
72f64d5
to
8649acd
Compare
8649acd
to
3235e1c
Compare
Update the script to sort the folders and files first (from most to least tests) and add them to the smallest bucket. Nevertheless, I need to check the tests, as some fail if they are executed randomly. |
script/split_tests.py
Outdated
|
||
def add_to_bucket(self) -> None: | ||
"""Add test file to bucket.""" | ||
if self.added_to_backet: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When can this happen? we run over a flattened list of all files, and process each file exactly once.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It should never happen. It's a safety if the script gets modified and suddenly a test will be added twice
@balloob I try to explain it better. The flatten function (renamed it to
The loop does the following:
We need the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome
Breaking change
Proposed change
The new
script/split_tests.py
script does the following:TestFolder
, add itself but also all it's children to the list)TestFolder
, check if the folder fits into the bucket. If yes add it, otherwise skip itTestFile
, it will always added to the smallest bucketpytest_buckets.txt
, where each line is a different bucket.pytest_bucket
artifact and can be used reproduce test issuesThis script is executed once and the produced file will be shared as an artifact to the test jobs.
The test jobs no longer need to discover all tests but only a subset specified by the bucket. This reduces a lot of overhead.
Comparison:
Savings 176 minutes -> ~ 3 hours on each full CI run
Additional explanation can be found in the comment #114381 (comment)
Type of change
Additional information
Checklist
ruff format homeassistant tests
)If user exposed functionality or configuration variables are added/changed:
If the code communicates with devices, web services, or third-party tools:
Updated and included derived files by running:
python3 -m script.hassfest
.requirements_all.txt
.Updated by running
python3 -m script.gen_requirements_all
..coveragerc
.To help with the load of incoming pull requests: