From e466bc917e070e34208a52838a0e21730345a78f Mon Sep 17 00:00:00 2001 From: Alex Gaynor Date: Thu, 6 Jul 2017 23:43:47 -0400 Subject: FIxed #266 -- attempt to deflake our tests (#660) * FIxed #266 -- attempt to deflake our tests * typo --- tests/test_crypto.py | 7 ++++++- tox.ini | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/tests/test_crypto.py b/tests/test_crypto.py index 4b99bd9..04970fa 100644 --- a/tests/test_crypto.py +++ b/tests/test_crypto.py @@ -22,6 +22,8 @@ from cryptography.hazmat.backends.openssl.backend import backend from cryptography.hazmat.primitives import serialization from cryptography.hazmat.primitives.asymmetric import rsa +import flaky + from OpenSSL.crypto import TYPE_RSA, TYPE_DSA, Error, PKey, PKeyType from OpenSSL.crypto import X509, X509Type, X509Name, X509NameType from OpenSSL.crypto import ( @@ -1626,7 +1628,7 @@ WpOdIpB8KksUTCzV591Nr1wd not_before = datetime.strptime( cert.get_notBefore().decode(), "%Y%m%d%H%M%SZ" ) - not_before_max = datetime.utcnow() + timedelta(seconds=100) + not_before_max = datetime.utcnow() + timedelta(seconds=101) assert not_before_min <= not_before <= not_before_max def test_gmtime_adj_notAfter_wrong_args(self): @@ -3215,6 +3217,9 @@ class TestCRL(object): b'Issuer: /C=US/ST=IL/L=Chicago/O=Testing/CN=Testing Root CA' ) + # Flaky because we compare the output of running commands which sometimes + # varies by 1 second + @flaky.flaky def test_export_text(self): """ If passed ``FILETYPE_TEXT`` for the format, ``CRL.export`` returns a diff --git a/tox.ini b/tox.ini index 76e1c5b..f655009 100644 --- a/tox.ini +++ b/tox.ini @@ -9,6 +9,7 @@ deps = coverage>=4.2 pytest>=3.0.1 pretend + flaky cryptographyMaster: git+https://github.com/pyca/cryptography.git cryptographyMinimum: cryptography<=1.9 setenv = -- cgit v1.2.1