From f7009e2a35ce6dc0113cf373db06f5f9938f6748 Mon Sep 17 00:00:00 2001 From: Joseph Sutton Date: Mon, 2 Oct 2023 13:58:00 +1300 Subject: [PATCH] python:tests: Use now() instead of utcnow() utcnow() is deprecated and will be removed in a future version of Python. Signed-off-by: Joseph Sutton Reviewed-by: Andrew Bartlett --- python/samba/tests/gpo.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/python/samba/tests/gpo.py b/python/samba/tests/gpo.py index 744c348302a..c317bd8d15e 100644 --- a/python/samba/tests/gpo.py +++ b/python/samba/tests/gpo.py @@ -72,7 +72,7 @@ from cryptography.hazmat.primitives import hashes from cryptography.hazmat.backends import default_backend from cryptography.hazmat.primitives.asymmetric import rsa from cryptography.hazmat.primitives.serialization import Encoding -from datetime import datetime, timedelta +from datetime import datetime, timedelta, timezone from samba.samba3 import param as s3param def dummy_certificate(): @@ -81,7 +81,7 @@ def dummy_certificate(): os.environ.get('SERVER')) ]) cons = x509.BasicConstraints(ca=True, path_length=0) - now = datetime.utcnow() + now = datetime.now(tz=timezone.utc) key = rsa.generate_private_key(public_exponent=65537, key_size=2048, backend=default_backend())