GH-103857: Deprecate utcnow and utcfromtimestamp (#103858)

Using `datetime.datetime.utcnow()` and `datetime.datetime.utcfromtimestamp()` will now raise a `DeprecationWarning`.

We also have removed our internal uses of these functions and documented the change.
This commit is contained in:
Paul Ganssle 2023-04-27 11:32:30 -06:00 committed by GitHub
parent a5308e188b
commit 0b7fd8ffc5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 101 additions and 34 deletions

View file

@ -517,7 +517,7 @@ class DateTimeTests(unittest.TestCase):
self.assertEqual(ts, ts2)
def test_sql_timestamp(self):
now = datetime.datetime.utcnow()
now = datetime.datetime.now(tz=datetime.UTC)
self.cur.execute("insert into test(ts) values (current_timestamp)")
self.cur.execute("select ts from test")
with self.assertWarnsRegex(DeprecationWarning, "converter"):