Skip to content

Commit

Permalink
test(alerter): fix time and timezone issues in alerter tests
Browse files Browse the repository at this point in the history
Fixes #1330

Some tests wouldn't pass locally if `TZ` was unset, or not set to to,
e.g., UTC.

One issue was the fallback to `"local"` if `TZ` was unset - this is a
valid value internally within simplemonitor, but I don't think valid as
a time zone.

Also, having many tests use the local timezone creates some
unpredictability in cases where there are hardcoded offsets, or where
the test depends on the local timezone having a specific offset from
UTC.

Mock `TZ` as `UTC` or `MST` explicitly, and adjust existing tests based
on offsets from that where needed.

Fix / unskip some skipped tests
  • Loading branch information
wyardley committed Feb 9, 2025
1 parent 2c6edcb commit b91074b
Show file tree
Hide file tree
Showing 2 changed files with 241 additions and 223 deletions.
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ per-file-ignores =
simplemonitor/__init__.py:F401

[isort]
known_third_party = arrow,boto3,botocore,freezegun,importlib_metadata,jinja2,markupsafe,oauthlib,paho,paramiko,psutil,pyaarlo,pytest,requests,ring_doorbell,sphinx,sphinx_rtd_theme,twilio,win32event,win32service,win32serviceutil
known_third_party = arrow,boto3,botocore,freezegun,importlib_metadata,jinja2,markupsafe,oauthlib,paho,paramiko,psutil,pyaarlo,requests,ring_doorbell,sphinx,sphinx_rtd_theme,twilio,win32event,win32service,win32serviceutil
known_first_party = Alerters,Loggers,Monitors,envconfig,util,simplemonitor
line_length=88
multi_line_output=3
Expand Down
Loading

0 comments on commit b91074b

Please sign in to comment.