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

Replace utcnow (and fix style along the way) #199

Merged
merged 4 commits into from
May 27, 2024

Conversation

mraspaud
Copy link
Member

This PR replaces usages of utcnow in trollmoves.
Ruff wasn't happy about some of the code, so style was modified accordingly.

@mraspaud mraspaud self-assigned this May 27, 2024
@mraspaud mraspaud requested a review from pnuu as a code owner May 27, 2024 07:03
Copy link
Member

@pnuu pnuu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For 3.10 support we need to use dt.timezone.utc.

bin/remove_it.py Outdated
@@ -231,7 +246,7 @@ def clean_section(pub, section, conf, is_dry_run=True):
kws[key] = int(info[key])
except KeyError:
pass
ref_time = datetime.utcnow() - timedelta(**kws)
ref_time = dt.datetime.now(dt.UTC) - dt.timedelta(**kws)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dt.UTC is added in 3.11 so it won't work with Python 3.10 which we support. Until we drop 3.10 we should use dt.timezone.utc instead.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, fixed

Copy link

codecov bot commented May 27, 2024

Codecov Report

Attention: Patch coverage is 80.00000% with 1 lines in your changes are missing coverage. Please review.

Project coverage is 91.12%. Comparing base (b67812c) to head (2834106).
Report is 17 commits behind head on main.

Current head 2834106 differs from pull request most recent head 1ed636f

Please upload reports for the commit 1ed636f to get more accurate results.

Files Patch % Lines
trollmoves/server.py 50.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #199      +/-   ##
==========================================
- Coverage   91.28%   91.12%   -0.17%     
==========================================
  Files          26       26              
  Lines        5417     5406      -11     
==========================================
- Hits         4945     4926      -19     
- Misses        472      480       +8     
Flag Coverage Δ
unittests 91.12% <80.00%> (-0.17%) ⬇️

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.

Copy link
Member

@pnuu pnuu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

@mraspaud mraspaud merged commit 9759ff8 into pytroll:main May 27, 2024
4 of 5 checks passed
@mraspaud mraspaud deleted the fix-utcnow branch May 27, 2024 09:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants