-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
DEPR: parsing to tzlocal #50949
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
DEPR: parsing to tzlocal #50949
Conversation
@@ -67,6 +67,7 @@ def test_parsing_timezone_offsets(dt_string, expected_tz): | |||
assert result_tz == timezone(timedelta(minutes=expected_tz)) | |||
|
|||
|
|||
@pytest.mark.filterwarnings("ignore:.*dependent on system timezone.*:FutureWarning") | |||
def test_parsing_non_iso_timezone_offset(): | |||
dt_string = "01-01-2013T00:00:00.000000000+0000" |
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.
Shouldn't a UTC offset like this be okay?
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.
not sure why but this triggered the tzlocal warning on one the builds. best guess is that build had the system timezone set to gmt
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.
Hmm I thought the spirit of the original deprecation is to forbid the 3 letter abbreviated timezones?
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 spirit is to not give results that depend on your system timezone. so if there is a system-config that results in getting tzlocal in this case, that user will in the future get the same non-tzlocal tzinfo that everyone else gets. i.e. this is not going to start raising for anybody.
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.
Okay that makes sense. I am just concerned about the seemingly false positive for this test case
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.
Agreed. im open to suggestions on how to avoid it
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 like many CI runs have time.tzname == ("UTC", "UTC")
, end up getting tzlocal instead of a tzutc(). Updated to avoid warning in that case.
i think issues have been addressed. |
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.
Lovely - system-dependent behaviour is really hard to debug
Nice thanks @jbrockmendel |
I think this needed a rebase? Seeing this on main
|
Yah, we'll need to change that to check py_parse_datetime_string |
have opened a pr |
doc/source/whatsnew/vX.X.X.rst
file if fixing a bug or adding a new feature.