Repository: pyca/pyopenssl
Pull request #1219 (2023-05-31 03:11:51)

bump version


Patch:
diff --git a/CHANGELOG.rst b/CHANGELOG.rst
index c036083..f0cf807 100644
--- a/CHANGELOG.rst
+++ b/CHANGELOG.rst
@@ -4,7 +4,7 @@ Changelog
 Versions are year-based with a strict backward-compatibility policy.
 The third digit is only for regressions.
 
-23.2.0 (UNRELEASED)
+23.2.0 (2023-05-30)
 -------------------
 
 Backward-incompatible changes:
@@ -19,6 +19,7 @@ Deprecations:
 Changes:
 ^^^^^^^^
 
+- ``cryptography`` maximum version has been increased to 41.0.x.
 - Invalid versions are now rejected in ``OpenSSL.crypto.X509Req.set_version``.
 - Added ``X509VerificationCodes`` to ``OpenSSL.SSL``.
   `#1202 <https://github.com/pyca/pyopenssl/pull/1202>`_.
diff --git a/setup.cfg b/setup.cfg
index 40a93c1..c33dc2e 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -1,6 +1,5 @@
 [tool:pytest]
-minversion = 3.0.1
-strict = true
+addopts = "-r s --strict-markers"
 testpaths = tests
 
 [metadata]
diff --git a/setup.py b/setup.py
index d548ccd..bcaffe9 100644
--- a/setup.py
+++ b/setup.py
@@ -99,7 +99,7 @@ if __name__ == "__main__":
         install_requires=[
             # Fix cryptographyMinimum in tox.ini when changing this!
             # 40.0.0 and .1 are missing X509_V_* constants that we re-export.
-            "cryptography>=38.0.0,<41,!=40.0.0,!=40.0.1",
+            "cryptography>=38.0.0,<42,!=40.0.0,!=40.0.1",
         ],
         extras_require={
             "test": ["flaky", "pretend", "pytest>=3.0.1"],
diff --git a/src/OpenSSL/version.py b/src/OpenSSL/version.py
index 60c945c..f1e941e 100644
--- a/src/OpenSSL/version.py
+++ b/src/OpenSSL/version.py
@@ -17,7 +17,7 @@ __all__ = [
     "__version__",
 ]
 
-__version__ = "23.2.0.dev"
+__version__ = "23.2.0"
 
 __title__ = "pyOpenSSL"
 __uri__ = "https://pyopenssl.org/"


Test patch:
diff --git a/tests/test_crypto.py b/tests/test_crypto.py
index 0f67d20..3429231 100644
--- a/tests/test_crypto.py
+++ b/tests/test_crypto.py
@@ -6,9 +6,9 @@ Unit tests for :py:mod:`OpenSSL.crypto`.
 """
 import base64
 import sys
+import warnings
 from datetime import datetime, timedelta
 from subprocess import PIPE, Popen
-from warnings import simplefilter
 
 from cryptography import x509
 from cryptography.hazmat.primitives import serialization
@@ -50,14 +50,15 @@ from OpenSSL.crypto import (
     load_certificate,
     load_certificate_request,
     load_crl,
-    load_pkcs12,
-    load_pkcs7_data,
     load_privatekey,
     load_publickey,
     sign,
     verify,
 )
 
+with pytest.warns(DeprecationWarning):
+    from OpenSSL.crypto import load_pkcs12, load_pkcs7_data
+
 from .util import (
     EqualityTestsMixin,
     NON_ASCII,
@@ -2604,7 +2605,7 @@ class TestPKCS12:
             b"pass:" + passwd,
         )
         with pytest.warns(DeprecationWarning) as w:
-            simplefilter("always")
+            warnings.simplefilter("always")
             p12 = load_pkcs12(p12_str, passphrase=b"whatever".decode("ascii"))
             msg = "{0} for passphrase is no longer accepted, use bytes".format(
                 WARNING_TYPE_EXPECTED
@@ -2823,7 +2824,7 @@ class TestPKCS12:
         p12 = self.gen_pkcs12(server_cert_pem, server_key_pem, root_cert_pem)
 
         with pytest.warns(DeprecationWarning) as w:
-            simplefilter("always")
+            warnings.simplefilter("always")
             dumped_p12 = p12.export(passphrase=b"randomtext".decode("ascii"))
             msg = "{0} for passphrase is no longer accepted, use bytes".format(
                 WARNING_TYPE_EXPECTED
@@ -3678,8 +3679,8 @@ class TestCRL:
         not emit a deprecation warning.
         """
         crl = self._get_crl()
-        with pytest.warns(None) as catcher:
-            simplefilter("always")
+        with warnings.catch_warnings(record=True) as catcher:
+            warnings.simplefilter("always")
         assert 0 == len(catcher)
         dumped_crl = crl.export(self.cert, self.pkey, digest=b"md5")
         text = _runopenssl(dumped_crl, b"crl", b"-noout", b"-text")
@@ -4368,14 +4369,14 @@ class TestSignVerify:
         cert = load_certificate(FILETYPE_PEM, root_cert_pem)
         for digest in ["md5", "sha1", "sha256"]:
             with pytest.warns(DeprecationWarning) as w:
-                simplefilter("always")
+                warnings.simplefilter("always")
                 sig = sign(priv_key, content, digest)
             assert "{0} for data is no longer accepted, use bytes".format(
                 WARNING_TYPE_EXPECTED
             ) == str(w[-1].message)
 
             with pytest.warns(DeprecationWarning) as w:
-                simplefilter("always")
+                warnings.simplefilter("always")
                 verify(cert, sig, content, digest)
             assert "{0} for data is no longer accepted, use bytes".format(
                 WARNING_TYPE_EXPECTED
diff --git a/tests/test_ssl.py b/tests/test_ssl.py
index 024436f..804288e 100644
--- a/tests/test_ssl.py
+++ b/tests/test_ssl.py
@@ -2769,7 +2769,7 @@ class TestConnection:
         ctx = Context(TLSv1_2_METHOD)
         ctx.use_privatekey(key)
         ctx.use_certificate(cert)
-        ctx.set_session_id("unity-test")
+        ctx.set_session_id(b"unity-test")
 
         def makeServer(socket):
             server = Connection(ctx, socket)