Skip to content

Commit

Permalink
Remove deprecated datetime.utcnow()
Browse files Browse the repository at this point in the history
  • Loading branch information
mesozoic committed Mar 22, 2024
1 parent cf3498f commit f93e545
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions tests/integration/test_integration_orm.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from datetime import datetime
from datetime import datetime, timezone

import pytest

Expand Down Expand Up @@ -116,8 +116,8 @@ def test_integration_orm(Contact, Address):
email="email@email.com",
is_registered=True,
address=[address],
birthday=datetime.utcnow().date(),
last_access=datetime.utcnow(),
birthday=datetime.now(timezone.utc).date(),
last_access=datetime.now(timezone.utc),
)

assert contact.first_name == "John"
Expand Down
6 changes: 3 additions & 3 deletions tests/test_orm.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from pyairtable.testing import fake_meta, fake_record
from pyairtable.utils import datetime_to_iso_str

NOW = datetime.utcnow().isoformat() + "Z"
NOW = datetime.now().isoformat() + "Z"


class Address(Model):
Expand Down Expand Up @@ -146,7 +146,7 @@ def test_readonly_field_not_saved():

record = {
"id": "recwnBLPIeQJoYVt4",
"createdTime": datetime.utcnow().isoformat(),
"createdTime": datetime.now(timezone.utc).isoformat(),
"fields": {
"Birthday": "1970-01-01",
"Age": 57,
Expand Down Expand Up @@ -284,7 +284,7 @@ def test_batch_save(mock_update, mock_create):
addr3 = Address.from_record(
{
"id": "recExistingRecord",
"createdTime": datetime.utcnow().isoformat(),
"createdTime": datetime.now(timezone.utc).isoformat(),
"fields": {"Number": 789, "Street": "Fake St"},
}
)
Expand Down

0 comments on commit f93e545

Please sign in to comment.