test: avoid local times near midnight for test_past_swap_days_buttons() - #4642
Merged
rjsparks merged 4 commits intoOct 26, 2022
Merged
Conversation
rjsparks
approved these changes
Oct 24, 2022
Codecov Report
@@ Coverage Diff @@
## main #4642 +/- ##
==========================================
- Coverage 88.43% 88.40% -0.03%
==========================================
Files 296 296
Lines 39716 39730 +14
==========================================
+ Hits 35122 35125 +3
- Misses 4594 4605 +11
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
rjsparks
approved these changes
Oct 26, 2022
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Fixes occasional failure in
test_past_swap_days_buttons(). That test assumed that, in the meeting time zone, a timeslot one second in the past was on the same day as one 9 minutes in the future. The time zone for the meeting was chosen at random. If the test ran at any time more than 51 minutes past the hour, there was a chance that these two meetings would fall on opposite sides of midnight in the meeting time zone. When this happened, the test failed.This PR introduces and uses a helper method
ietf.utils.timezone.timezone_not_near_midnight()that randomly chooses a time zone wheretimezone.now()represented in that zone is not between 23:00 and 00:59. This is done with a random guess-and-check usingpytz.common_timezones. This can change tozoneinfo.available_timezones()when we drop pytz (or before, though with a small risk that zoneinfo suggests a timezone not known to pytz).