Conversation
dd79a43 to
f62dfd1
Compare
armenzg
commented
Mar 13, 2026
Member
Author
There was a problem hiding this comment.
Most of the changes in these files is using before_now to freeze a datetime.
At the bottom of the PR, you will see some flake8 custom code to help catch this.
|
|
||
|
|
||
| class TestEAPGetErrorsCountsTimeseries(TestCase, SnubaTestCase): | ||
| FROZEN_TIME = before_now(hours=24).replace(hour=6, minute=0, second=0) |
Member
Author
There was a problem hiding this comment.
The pre-commit check will notice datetime(<this_year>, ... and complain.
| f"from datetime import datetime, timezone\n\n" | ||
| f"X = datetime({cy}, 1, 1, tzinfo=timezone.utc)\n", | ||
| filename="tests/x.py", | ||
| ) == [f"t.py:3:0: {msg}"] |
Member
Author
There was a problem hiding this comment.
A non-empty list means an error was caught.
| msg = _s015_msg(cy) | ||
| assert _run( | ||
| f"from datetime import datetime, timezone\n\n" | ||
| f"X = datetime({cy}, 1, 1, tzinfo=timezone.utc)\n", |
Member
Author
There was a problem hiding this comment.
Since it uses cy (current year) the test fill fail.
| ) | ||
| assert _run( | ||
| f"from freezegun import freeze_time\nfrom datetime import datetime, timezone\n\n" | ||
| f"@freeze_time(datetime({cy}, 1, 1, tzinfo=timezone.utc))\n" |
Member
Author
There was a problem hiding this comment.
freeze_time + current year -> failure
|
|
||
|
|
||
| def _is_tests_path(filename: str) -> bool: | ||
| return "tests/" in filename or "testutils/" in filename |
Member
Author
There was a problem hiding this comment.
This function will be used to only check test files.
trevor-e
approved these changes
Mar 13, 2026
joshuarli
approved these changes
Mar 13, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is a follow-up to #110643
Unfortunately, we wasted a lot of time until we realized it was a test time bomb that caused the multi-hour deployment backlog.
This prevents same year test time bombs and fixes some potential ones.