Closed spillner closed 1 month ago
Thanks @spillner for updating the pull request. Would it be possible to add a very simple test to test_util.py to parse a date using the new TimeZone_UTC class and check the output?
I'm +1 on merging once that is in place.
Tested the branch locally - all working as expected:
>>> import pytz
>>> from datetime import datetime, timedelta
>>> dt = datetime.utcnow()
>>> dt.replace(tzinfo=pytz.utc)
datetime.datetime(2024, 10, 8, 10, 7, 59, 167706, tzinfo=<UTC>)
>>> from owslib.util import TimeZone_UTC
>>> datetime.utcnow().replace(tzinfo=TimeZone_UTC())
datetime.datetime(2024, 10, 8, 10, 9, 31, 262084, tzinfo=<owslib.util.TimeZone_UTC object at 0x0000015D9D187CD0>)
Added two unit tests, one for datetime normalization as a standalone operation, and one for proper operation of extract_time() as a whole.
I also took advantage of the shift to 3.10 and newer to drop the TimeZone_UTC class in favor of the standard datetime.timezone.utc. If anyone needs to restore support for 3.8 and earlier, you could just roll back the very last commit in this series.
@spillner - thanks very much for this. Removing a dependency and being able to use the standard library is excellent.
Pytz no longer supports the latest Python releases, and not much of it was actually used by OWSLib anyway.
Recreated the previous PR #921 to permit branching my source repository, to better manage the rebase and elide false-positive merge conflicts reported by GitHub.