Uploaded image for project: 'Python Driver'
  1. Python Driver
  2. PYTHON-3849

[pymongocrypt] Address utcnow deprecation

      We need to apply the same utcnow change from PYTHON-3702 to pymongocrypt:

       [2023/07/17 19:56:51.329] =============================== warnings summary ===============================
       [2023/07/17 19:56:51.329] .venv/lib/python3.12/site-packages/dateutil/tz/tz.py:37
       [2023/07/17 19:56:51.329]   /data/mci/c3cdcbdfb9b436479082bb1ce97ee100/libmongocrypt/bindings/python/.venv/lib/python3.12/site-packages/dateutil/tz/tz.py:37: DeprecationWarning: datetime.utcfromtimestamp() is deprecated and scheduled for removal in a future version. Use timezone-aware objects to represent datetimes in UTC: datetime.fromtimestamp(timestamp, datetime.UTC).
       [2023/07/17 19:56:51.329]     EPOCH = datetime.datetime.utcfromtimestamp(0)
       [2023/07/17 19:56:51.329] test/test_mongocrypt.py::TestNeedKMSAzureCredentials::test_cache
       [2023/07/17 19:56:51.329] test/test_mongocrypt.py::TestNeedKMSAzureCredentials::test_cache_expires_soon
       [2023/07/17 19:56:51.329] test/test_mongocrypt.py::TestNeedKMSAzureCredentials::test_success
       [2023/07/17 19:56:51.329]   /data/mci/c3cdcbdfb9b436479082bb1ce97ee100/libmongocrypt/bindings/python/pymongocrypt/credentials.py:100: DeprecationWarning: datetime.utcnow() is deprecated and scheduled for removal in a future version. Use timezone-aware objects to represent datetimes in UTC: datetime.now(datetime.UTC).
       [2023/07/17 19:56:51.329]     expiration_time = datetime.utcnow() + timedelta(seconds=expires_in)
       [2023/07/17 19:56:51.329] test/test_mongocrypt.py::TestNeedKMSAzureCredentials::test_cache_expires_soon
       [2023/07/17 19:56:51.329]   /data/mci/c3cdcbdfb9b436479082bb1ce97ee100/libmongocrypt/bindings/python/pymongocrypt/credentials.py:66: DeprecationWarning: datetime.utcnow() is deprecated and scheduled for removal in a future version. Use timezone-aware objects to represent datetimes in UTC: datetime.now(datetime.UTC).
       [2023/07/17 19:56:51.329]     if creds.expires_in - datetime.utcnow() < timedelta(seconds=60):
       [2023/07/17 19:56:51.329] -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
      

      https://spruce.mongodb.com/task/libmongocrypt_rhel_80_64_bit_test_python_patch_a9cd5cab6a1eb71b13b5e3044e66d30f5429c59b_64b598b761837d254ecd8cc1_23_07_17_19_38_32/logs?execution=0

            Assignee:
            steve.silvester@mongodb.com Steve Silvester
            Reporter:
            shane.harvey@mongodb.com Shane Harvey
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: