Skip to content

Commit

Permalink
Stop using flaky lib, use pytest-rerunfailures instead (#1296)
Browse files Browse the repository at this point in the history
* Stop using flaky lib, use pytest-rerunfailures instead

flaky is not compatible with the latest pytest release and appears unmaintained, while pytest-rerunfailures is maintained by the pytest team

* ruff
  • Loading branch information
alex committed Mar 4, 2024
1 parent a972ea4 commit 510b0e5
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 7 deletions.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ def find_meta(meta):
"cryptography>=41.0.5,<43",
],
extras_require={
"test": ["flaky", "pretend", "pytest>=3.0.1"],
"test": ["pytest-rerunfailures", "pretend", "pytest>=3.0.1"],
"docs": [
"sphinx!=5.2.0,!=5.2.0.post0,!=7.2.5",
"sphinx_rtd_theme",
Expand Down
6 changes: 3 additions & 3 deletions tests/test_crypto.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
"""
Unit tests for :py:mod:`OpenSSL.crypto`.
"""

import base64
import sys
import warnings
from datetime import datetime, timedelta, timezone
from subprocess import PIPE, Popen

import flaky
import pytest
from cryptography import x509
from cryptography.hazmat.primitives import hashes, serialization
Expand Down Expand Up @@ -1864,7 +1864,7 @@ def test_gmtime_adj_notBefore_wrong_args(self):
with pytest.raises(TypeError):
cert.gmtime_adj_notBefore(None)

@flaky.flaky
@pytest.mark.flaky(reruns=2)
def test_gmtime_adj_notBefore(self):
"""
`X509.gmtime_adj_notBefore` changes the not-before timestamp to be the
Expand All @@ -1890,7 +1890,7 @@ def test_gmtime_adj_notAfter_wrong_args(self):
with pytest.raises(TypeError):
cert.gmtime_adj_notAfter(None)

@flaky.flaky
@pytest.mark.flaky(reruns=2)
def test_gmtime_adj_notAfter(self):
"""
`X509.gmtime_adj_notAfter` changes the not-after timestamp
Expand Down
3 changes: 1 addition & 2 deletions tests/test_ssl.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
from typing import Union
from weakref import ref

import flaky
import pytest
from cryptography import x509
from cryptography.hazmat.primitives import hashes, serialization
Expand Down Expand Up @@ -510,7 +509,7 @@ def test_set_cipher_list_wrong_type(self, context):
with pytest.raises(TypeError):
context.set_cipher_list(object())

@flaky.flaky
@pytest.mark.flaky(reruns=2)
def test_set_cipher_list_no_cipher_match(self, context):
"""
`Context.set_cipher_list` raises `OpenSSL.SSL.Error` with a
Expand Down
1 change: 0 additions & 1 deletion tests/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
U{Twisted<http://twistedmatrix.com/>}.
"""


# This is the UTF-8 encoding of the SNOWMAN unicode code point.
NON_ASCII = b"\xe2\x98\x83".decode("utf-8")

Expand Down

0 comments on commit 510b0e5

Please sign in to comment.