Skip to content

Commit

Permalink
maint: stop using deprecated utcnow
Browse files Browse the repository at this point in the history
Potentially it might be addressing
- gabrielfalcao#474

In our case we got datalad tests failing since we trigger errors on all new
deprecation warnigns and this was the one this time

    .pybuild/cpython3_3.12_datalad/build/datalad/downloaders/tests/test_http.py: 13 warnings
      /usr/lib/python3/dist-packages/httpretty/core.py:1077: DeprecationWarning: datetime.datetime.utcnow() is deprecated and scheduled for removal in a future version. Use timezone-aware objects to represent datetimes in UTC: datetime.datetime.now(datetime.UTC).
        now = datetime.utcnow()
  • Loading branch information
yarikoptic committed Nov 19, 2024
1 parent 4e09d5a commit cac2f9d
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions httpretty/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,7 @@

from .errors import HTTPrettyError, UnmockedError

from datetime import datetime
from datetime import timedelta
from datetime import (datetime, timedelta, UTC)
from errno import EAGAIN

old_socket = socket.socket
Expand Down Expand Up @@ -611,7 +610,7 @@ def normalize_headers(self, headers):
return new

def fill_filekind(self, fk):
now = datetime.utcnow()
now = datetime.now(UTC)

headers = {
'status': self.status,
Expand Down

0 comments on commit cac2f9d

Please sign in to comment.