From d5155d28d3c5d6a9c1d539255f75476490c22f7c Mon Sep 17 00:00:00 2001 From: Daniel Kahn Gillmor Date: Tue, 9 May 2023 15:58:38 -0400 Subject: [PATCH] tests: Avoid passing naive datetime objects --- tests/test_99_regressions.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/test_99_regressions.py b/tests/test_99_regressions.py index da12d079..fac50591 100644 --- a/tests/test_99_regressions.py +++ b/tests/test_99_regressions.py @@ -19,7 +19,7 @@ def test_reg_bug_56(): # some imports only used by this regression test import hashlib - from datetime import datetime + from datetime import datetime, timezone from pgpy.pgp import PGPSignature @@ -135,7 +135,7 @@ def test_reg_bug_56(): sig = PGPSignature.new(SignatureType.BinaryDocument, PubKeyAlgorithm.RSAEncryptOrSign, HashAlgorithm.SHA512, sk.fingerprint.keyid) - sig._signature.subpackets['h_CreationTime'][-1].created = datetime(2014, 8, 6, 23, 28, 51) + sig._signature.subpackets['h_CreationTime'][-1].created = datetime(2014, 8, 6, 23, 28, 51, tzinfo=timezone.utc) sig._signature.subpackets.update_hlen() hdata = sig.hashdata(sigsubject) sig._signature.hash2 = hashlib.new('sha512', hdata).digest()[:2]