You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
TST: Separate remote and non-remote tests in docs/coordinates/index.rst #14646
As @eerovaher stated in #14286 (comment) , "There's two related examples here close to each other. The first example shows how to get the name of a timezone and that can be left as a remote test. The second example demonstrates using a ZoneInfo object created from the timezone name and can be made a non-remote test if tz_name is defined in a setup block."
In docs/coordinates/index.rst:
.. doctest-remote-data::
>>> loc = EarthLocation.of_address('Tucson, AZ')
>>> from timezonefinder import TimezoneFinder
>>> tz_name = TimezoneFinder().timezone_at(lng=loc.lon.degree,
... lat=loc.lat.degree)
>>> tz_name'America/Phoenix'
The resulting timezone name could then be used with any packages that support
time zone definitions, such as the (Python 3.9 default package) `zoneinfo<https://docs.python.org/3/library/zoneinfo.html>`_:
.. doctest-remote-data::
>>> import datetime
>>> from zoneinfo import ZoneInfo
>>> tz = ZoneInfo(tz_name)
>>> dt = datetime.datetime(2021, 4, 12, 20, 0, 0, tzinfo=tz)
The reason this wasn't done already in #14286 was that it lead to some test failures because it seems that the Docker images used for those tests did not have timezone info available. Addressing this issue requires editing Docker configuration, which I don't think is something we should label as good first issue.
Activity
eerovaher commentedon Apr 19, 2023
The reason this wasn't done already in #14286 was that it lead to some test failures because it seems that the Docker images used for those tests did not have timezone info available. Addressing this issue requires editing Docker configuration, which I don't think is something we should label as
good first issue.pllim commentedon Apr 19, 2023
Ah, I missed the point about Docker. Thanks for the clarification!
eerovaher commentedon Apr 19, 2023
See also #14286 (comment)