miguelgrinberg / microblog-api

A modern (as of 2024) Flask API back end.
MIT License
367 stars 99 forks source link

remove deprecated datetime.utcnow #29

Closed yuxiaoy1 closed 5 months ago

yuxiaoy1 commented 9 months ago

I'd like to format the whole codebase using Ruff, what do you think? @miguelgrinberg

miguelgrinberg commented 9 months ago

@yuxiaoy1 No, thanks. I manage many projects and prefer to have a consistent management solution. When/if I decide to auto-format my code, I'll implement a general solution across all my projects.

yuxiaoy1 commented 5 months ago

Hello @miguelgrinberg , can you help with the github CI errors, thank you.

miguelgrinberg commented 5 months ago

The CI errors indicate you haven't given this problem enough thought. The change is not as simple as you may have initially thought. When I have time I'll look into this myself.

FAILED tests/test_auth.py::AuthTests::test_get_token - TypeError: can't compare offset-naive and offset-aware datetimes
FAILED tests/test_auth.py::AuthTests::test_oauth - TypeError: can't compare offset-naive and offset-aware datetimes
FAILED tests/test_auth.py::AuthTests::test_refresh_revoke_all - TypeError: can't compare offset-naive and offset-aware datetimes
FAILED tests/test_auth.py::AuthTests::test_refresh_token - TypeError: can't compare offset-naive and offset-aware datetimes
FAILED tests/test_auth.py::AuthTests::test_revoke - TypeError: can't compare offset-naive and offset-aware datetimes
FAILED tests/test_auth.py::AuthTests::test_token_expired - TypeError: '>' not supported between instances of 'datetime.datetime' and 'MagicMock'
miguelgrinberg commented 5 months ago

I have made this change myself now. Thanks.