python-babel / babel

The official repository for Babel, the Python Internationalization Library
http://babel.pocoo.org/
BSD 3-Clause "New" or "Revised" License
1.34k stars 448 forks source link

Fix deprecation warnings for `datetime.utcnow()` #1119

Closed tomasr8 closed 3 months ago

tomasr8 commented 3 months ago

This shows up when running the tests on 3.12:

~dev/babel/tests/test_dates.py:757: DeprecationWarning: datetime.datetime.utcnow() is deprecated and scheduled for removal in a future version. Use timezone-aware objects to rep
resent datetimes in UTC: datetime.datetime.now(datetime.UTC).                                                                                                                                 
    assert dates.format_datetime(datetime.utcnow(), locale="ja_JP@mod")

I think there's no harm in using plain datetime.now() for these tests.

codecov[bot] commented 3 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 91.22%. Comparing base (cf7d223) to head (0969ad5). Report is 1 commits behind head on master.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #1119 +/- ## ======================================= Coverage 91.22% 91.22% ======================================= Files 27 27 Lines 4561 4561 ======================================= Hits 4161 4161 Misses 400 400 ``` | [Flag](https://app.codecov.io/gh/python-babel/babel/pull/1119/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=python-babel) | Coverage Δ | | |---|---|---| | [macos-12-3.10](https://app.codecov.io/gh/python-babel/babel/pull/1119/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=python-babel) | `90.02% <ø> (ø)` | | | [macos-12-3.11](https://app.codecov.io/gh/python-babel/babel/pull/1119/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=python-babel) | `89.95% <ø> (ø)` | | | [macos-12-3.12](https://app.codecov.io/gh/python-babel/babel/pull/1119/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=python-babel) | `90.13% <ø> (ø)` | | | [macos-12-3.13-dev](https://app.codecov.io/gh/python-babel/babel/pull/1119/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=python-babel) | `89.65% <ø> (ø)` | | | [macos-12-3.8](https://app.codecov.io/gh/python-babel/babel/pull/1119/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=python-babel) | `89.95% <ø> (ø)` | | | [macos-12-3.9](https://app.codecov.io/gh/python-babel/babel/pull/1119/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=python-babel) | `89.95% <ø> (ø)` | | | [macos-12-pypy3.10](https://app.codecov.io/gh/python-babel/babel/pull/1119/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=python-babel) | `90.02% <ø> (ø)` | | | [ubuntu-22.04-3.10](https://app.codecov.io/gh/python-babel/babel/pull/1119/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=python-babel) | `90.04% <ø> (ø)` | | | [ubuntu-22.04-3.11](https://app.codecov.io/gh/python-babel/babel/pull/1119/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=python-babel) | `89.98% <ø> (ø)` | | | [ubuntu-22.04-3.12](https://app.codecov.io/gh/python-babel/babel/pull/1119/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=python-babel) | `90.15% <ø> (ø)` | | | [ubuntu-22.04-3.13-dev](https://app.codecov.io/gh/python-babel/babel/pull/1119/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=python-babel) | `89.67% <ø> (ø)` | | | [ubuntu-22.04-3.8](https://app.codecov.io/gh/python-babel/babel/pull/1119/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=python-babel) | `89.97% <ø> (ø)` | | | [ubuntu-22.04-3.9](https://app.codecov.io/gh/python-babel/babel/pull/1119/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=python-babel) | `89.97% <ø> (ø)` | | | [ubuntu-22.04-pypy3.10](https://app.codecov.io/gh/python-babel/babel/pull/1119/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=python-babel) | `90.04% <ø> (ø)` | | | [windows-2022-3.10](https://app.codecov.io/gh/python-babel/babel/pull/1119/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=python-babel) | `90.16% <ø> (ø)` | | | [windows-2022-3.11](https://app.codecov.io/gh/python-babel/babel/pull/1119/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=python-babel) | `90.10% <ø> (ø)` | | | [windows-2022-3.12](https://app.codecov.io/gh/python-babel/babel/pull/1119/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=python-babel) | `90.27% <ø> (ø)` | | | [windows-2022-3.13-dev](https://app.codecov.io/gh/python-babel/babel/pull/1119/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=python-babel) | `89.79% <ø> (ø)` | | | [windows-2022-3.8](https://app.codecov.io/gh/python-babel/babel/pull/1119/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=python-babel) | `90.09% <ø> (ø)` | | | [windows-2022-3.9](https://app.codecov.io/gh/python-babel/babel/pull/1119/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=python-babel) | `90.09% <ø> (ø)` | | | [windows-2022-pypy3.10](https://app.codecov.io/gh/python-babel/babel/pull/1119/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=python-babel) | `90.16% <ø> (ø)` | | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=python-babel#carryforward-flags-in-the-pull-request-comment) to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.