-
Notifications
You must be signed in to change notification settings - Fork 538
tests: Add fail_on_changes
to toxgen
#4072
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
Conversation
fail_on_changes
to toxgen
❌ 1 Tests Failed:
View the top 1 failed test(s) by shortest run time
To view more test analytics, go to the Test Analytics Dashboard |
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.
Looks good, but please address comments before merging
if older_than is not None: | ||
if datetime.fromisoformat(meta["upload_time_iso_8601"]) > older_than: | ||
continue |
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.
[nit – feel free to ignore]
if older_than is not None: | |
if datetime.fromisoformat(meta["upload_time_iso_8601"]) > older_than: | |
continue | |
if older_than is not None and datetime.fromisoformat(meta["upload_time_iso_8601"]) > older_than: | |
continue |
scripts/populate_tox/populate_tox.py
Outdated
Please make sure to not make manual changes to `tox.ini`. The file | ||
is generated from a template in `scripts/populate_tox/tox.jinja` | ||
by the `scripts/populate_tox/populate_tox.py` script. Any changes | ||
should be made to the template or the script directly and the | ||
resulting `tox.ini` file should be generated with: |
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.
Some suggestions to improve readability and clarity:
Please make sure to not make manual changes to `tox.ini`. The file | |
is generated from a template in `scripts/populate_tox/tox.jinja` | |
by the `scripts/populate_tox/populate_tox.py` script. Any changes | |
should be made to the template or the script directly and the | |
resulting `tox.ini` file should be generated with: | |
Please do not make manual changes to `tox.ini`. The | |
`scripts/populate_tox/populate_tox.py` script generates `tox.ini` | |
using the `scripts/populate_tox/tox.jinja` template. | |
Instead, modify the template or the script as needed, then run the | |
following commands to regenerate `tox.ini`: |
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.
Reworded this to also include #4072 (comment)
scripts/populate_tox/populate_tox.py
Outdated
Detected an unexpected change in `tox.ini` that is not reflected | ||
in `tox.jinja` and/or `populate_tox.py`. |
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.
Can this error also occur if the jinja template and/or populate_tox.py
script are changed, but we forget to regenerate the tox.ini
file afterwards? If yes, please mention this possibility, as well
Add
fail_on_changes
to toxgen. The idea is that the script will now have two modes:fail_on_changes
isFalse
) that is used to actually generate thetox.ini
file. This will be run in a cron job in CI and create a PR with the updated test setup.fail_on_changes
isTrue
) that is used to detect manual changes to one of the affected files without updating the rest (e.g. making a manual change totox.ini
without updating thetox.jinja
template). This will be run in CI similar to thefail_on_changes
check ofsplit-tox-gh-actions
.The problem with detecting manual changes is that if we just reran the script on each PR, chances are it would pull in new releases that are not part of the
tox.ini
on master, making the file look different from what was committed as if it had unrelated manual changes.To counteract this, we now store the timestamp when the file was last generated in
tox.ini
. We use this in fail-on-changes mode to filter out releases that popped up after the file was last generated. This way, the package versions should be the same and if there is anything different intox.ini
, it's likely to be the manual changes that we want to detect.Closes #4051