From 1228724bf71d6eee7be54ed2fe944140396ed483 Mon Sep 17 00:00:00 2001 From: Erica Portnoy Date: Fri, 3 Jan 2025 15:17:07 -0800 Subject: [PATCH 1/4] filter warning caused by deprecated pyopenssl usage of datetime --- tests/util_test.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/util_test.py b/tests/util_test.py index cee8b0a6..44c2b7e8 100644 --- a/tests/util_test.py +++ b/tests/util_test.py @@ -22,7 +22,9 @@ def setUp(self) -> None: self.cert_other = test_util.load_comparable_cert("cert-san.pem") def test_getattr_proxy(self) -> None: - assert self.cert1.has_expired() is True + with warnings.catch_warnings(): + warnings.filterwarnings('ignore', message='datetime.datetime.utcnow() is deprecated') + assert self.cert1.has_expired() is True def test_eq(self) -> None: assert self.req1 == self.req2 From d63079ec1f2e557122077a225d8db2b9b1319b66 Mon Sep 17 00:00:00 2001 From: Erica Portnoy Date: Fri, 3 Jan 2025 15:18:15 -0800 Subject: [PATCH 2/4] import warning --- tests/util_test.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/util_test.py b/tests/util_test.py index 44c2b7e8..baeec027 100644 --- a/tests/util_test.py +++ b/tests/util_test.py @@ -3,6 +3,7 @@ import functools import sys import unittest +import warnings import pytest import test_util From c69d9d5ca52a128daa9ac96a108755405f739d46 Mon Sep 17 00:00:00 2001 From: Erica Portnoy Date: Fri, 3 Jan 2025 15:42:41 -0800 Subject: [PATCH 3/4] update syntax --- tests/util_test.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/util_test.py b/tests/util_test.py index baeec027..fa850958 100644 --- a/tests/util_test.py +++ b/tests/util_test.py @@ -24,7 +24,8 @@ def setUp(self) -> None: def test_getattr_proxy(self) -> None: with warnings.catch_warnings(): - warnings.filterwarnings('ignore', message='datetime.datetime.utcnow() is deprecated') + warnings.filterwarnings('ignore', category=DeprecationWarning, + message='.*Use timezone-aware objects to represent datetimes') assert self.cert1.has_expired() is True def test_eq(self) -> None: From 5c7aadf1bb8fe14f64641b94503982eaeb212cfc Mon Sep 17 00:00:00 2001 From: Erica Portnoy Date: Fri, 3 Jan 2025 16:05:47 -0800 Subject: [PATCH 4/4] formatting --- tests/util_test.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tests/util_test.py b/tests/util_test.py index fa850958..09edab03 100644 --- a/tests/util_test.py +++ b/tests/util_test.py @@ -24,8 +24,11 @@ def setUp(self) -> None: def test_getattr_proxy(self) -> None: with warnings.catch_warnings(): - warnings.filterwarnings('ignore', category=DeprecationWarning, - message='.*Use timezone-aware objects to represent datetimes') + warnings.filterwarnings( + "ignore", + category=DeprecationWarning, + message=".*Use timezone-aware objects to represent datetimes", + ) assert self.cert1.has_expired() is True def test_eq(self) -> None: