From 32be4af852592507e269e12dfc6141558f296428 Mon Sep 17 00:00:00 2001 From: Noah Levitt Date: Tue, 9 May 2017 12:43:31 -0700 Subject: [PATCH] this technique should really work in all the pythons --- test/test_certauth.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/test/test_certauth.py b/test/test_certauth.py index ce84279..f3c1c88 100644 --- a/test/test_certauth.py +++ b/test/test_certauth.py @@ -5,6 +5,7 @@ import tempfile from OpenSSL import crypto import datetime +import time def setup_module(): global TEST_CA_DIR @@ -83,6 +84,7 @@ def test_create_root_subdir(): actual_not_after = datetime.datetime.strptime( cert.get_notAfter().decode('ascii'), '%Y%m%d%H%M%SZ') - assert abs((actual_not_before.timestamp() - expected_not_before.timestamp())) < 10 - assert abs((actual_not_after.timestamp() - expected_not_after.timestamp())) < 10 + time.mktime(expected_not_before.utctimetuple()) + assert abs((time.mktime(actual_not_before.utctimetuple()) - time.mktime(expected_not_before.utctimetuple()))) < 10 + assert abs((time.mktime(actual_not_after.utctimetuple()) - time.mktime(expected_not_after.utctimetuple()))) < 10