-
-
Notifications
You must be signed in to change notification settings - Fork 31.9k
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
Fix CI test_invalid_rrule_fix test by freezing the time #105294
Conversation
Hey there @allenporter, mind taking a look at this pull request as it has been labeled with an integration ( Code owner commandsCode owners of
|
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, thanks 👍
@@ -1301,6 +1301,7 @@ async def test_event_differs_timezone( | |||
} | |||
|
|||
|
|||
@pytest.mark.freeze_time("2023-11-30 12:15:00 +00:00") |
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.
How was the datetime selected? It doesn't match any of the recurrence dates, which seem to be one Friday a month. Is that correct?
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 overlaps with one of the Fridays. Is that the idea?
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.
The tests takes the current time, I guess that is the reason why this test could pass before. So I picked a time in the past.
Possible the test it self needs improvements too, as this might be a bug. But that is something to be addressed in an other PR.
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 overlaps with one of the Fridays. Is that the idea?
I was just lucky to find a date and time that made the test pass to be honest.
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.
The thing that went wrong is the calendar entity that was on or off based if the current time fell into the calendar event rule or not.
This made the test flaky by design. This is a correct adjustment IMHO, as it time outside of the event (which was validated by assert state.state == STATE_OFF
).
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.
Ok, I guess we can merge for now if it passes, but @allenporter should follow up and check if this is intended.
Proposed change
Fix CI
test_invalid_rrule_fix
test by freezing the time. The test used the current time, but that fails if the current time falls outside of the event scope. Freezing the time fixes consistency the test.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: