Skip to content
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

adapt to timezone-aware objects #58

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

MeggyCal
Copy link

Python 3.12 now strongly preffers timezone-aware datetime objects and some libraries have already been adapted to that. I didn't investigate which libraries, maybe the change is only a PR and we patched it in our distribution. However, the produced datetimes are now timezone-aware (or will be in near future) and this adapts pypsexec tests to this change.

@jborean93
Copy link
Owner

This change seems to only be for testing files and not for datetimes produced by this library. The things it is testing seems to be from its dependency https://github.com/jborean93/smbprotocol which was fixed with jborean93/smbprotocol#252.

While yes our test should be updated it should be updated so it's not using the deprecated datetime.utcfromtimestamp method but instead datetime.fromtimestamp(*args, tzinfo=timezone.utc).

@MeggyCal
Copy link
Author

MeggyCal commented Apr 2, 2024

In my point of view it is better for the compatibility when the library accepts also timezone-naive datetimes, so I didn't want the changes to be too widespread. Anyway, should I make more changes? Where, how?

@jborean93
Copy link
Owner

The changes in this PR are just for tests and not part of the actual codebase. It also continues to use the deprecated utcfromtimestamp method whereas it should be swapped to the fromtimestamp methods. While this should be fixed this is for tests only so it's not user facing.

@MeggyCal
Copy link
Author

MeggyCal commented Apr 3, 2024

True, this is not user-facing, so it is not urgent to merge 🥲 . And I agree this is more of a hotfix than improvement.

@jborean93
Copy link
Owner

What I'm trying to say is I'm happy to merge this but it should be using the non-deprecated API fromtimestamp not the deprecated one utcfromtimestamp. Granted I've also not run CI in this repo for a while so there's bound to be other breakages.

Copy link

codecov bot commented Apr 4, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.52%. Comparing base (c5e8151) to head (13461e9).

Additional details and impacted files
@@            Coverage Diff             @@
##           master      #58      +/-   ##
==========================================
+ Coverage   98.15%   98.52%   +0.36%     
==========================================
  Files           7        7              
  Lines        1085     1085              
==========================================
+ Hits         1065     1069       +4     
+ Misses         20       16       -4     
Flag Coverage Δ
98.52% <ø> (+0.36%) ⬆️
py3.10 98.52% <ø> (+0.36%) ⬆️
py3.11 98.52% <ø> (+0.36%) ⬆️
py3.7 98.52% <ø> (+0.46%) ⬆️
py3.8 98.43% <ø> (+0.46%) ⬆️
py3.9 98.43% <ø> (+0.46%) ⬆️
x64 98.52% <ø> (+0.36%) ⬆️
x86 98.05% <ø> (-0.10%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants