Skip to content

Add tests for time conversions in tools package #2340

Open
@markcampanelli

Description

Is your feature request related to a problem? Please describe.
I am looking into replacing pytz with the standard library's zoneinfo, and I found three untested functions that use pytz:

  • pvlib.tools.localize_to_utc
  • pvlib.tools.datetime_to_djd
  • pvlib.tools.djd_to_datetime

Describe the solution you'd like
Add tests for these three functions before attempting to replace pytz in a refactor.

Describe alternatives you've considered
Adding tests should be a welcome endeavor, no matter if pytz is replaced or not.

Additional context
None.

UPDATE: #2341 that addresses this issue moves to the Python 3.9+ standard library's zoneinfo.ZoneInfo as the single source of truth that represents a timezone internally in Location objects. Also, the interface to this object was made consistent between the Location intializer and updating the tz string attribute after object initialization (and tz is now always a string, as previous advertised). However, Location objects still all existing types for initializing tz, as well as still exposing a pytz representation of the Location's timezone as the read-only pytz attribute.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions