[Python-checkins] bpo-45185: enables `TestEnumerations` in `test_ssl` (GH-28330)

serhiy-storchaka webhook-mailer at python.org
Wed Sep 15 12:57:11 EDT 2021


https://github.com/python/cpython/commit/d897579a80da3f4572d96501c41bec6cacb10d84
commit: d897579a80da3f4572d96501c41bec6cacb10d84
branch: main
author: Nikita Sobolev <mail at sobolevn.me>
committer: serhiy-storchaka <storchaka at gmail.com>
date: 2021-09-15T19:57:03+03:00
summary:

bpo-45185: enables `TestEnumerations` in `test_ssl` (GH-28330)

files:
A Misc/NEWS.d/next/Tests/2021-09-14-14-54-04.bpo-45185.qFx5I6.rst
M Lib/test/test_ssl.py

diff --git a/Lib/test/test_ssl.py b/Lib/test/test_ssl.py
index d9e184365ce08..556c1cf2792ad 100644
--- a/Lib/test/test_ssl.py
+++ b/Lib/test/test_ssl.py
@@ -4969,17 +4969,18 @@ def test_sslmethod(self):
                 lambda name: name.startswith('PROTOCOL_') and name != 'PROTOCOL_SSLv23',
                 source=ssl._ssl,
                 )
+        # This member is assigned dynamically in `ssl.py`:
+        Checked_SSLMethod.PROTOCOL_SSLv23 = Checked_SSLMethod.PROTOCOL_TLS
         enum._test_simple_enum(Checked_SSLMethod, ssl._SSLMethod)
 
     def test_options(self):
         CheckedOptions = enum._old_convert_(
-                enum.FlagEnum, 'Options', 'ssl',
+                enum.IntFlag, 'Options', 'ssl',
                 lambda name: name.startswith('OP_'),
                 source=ssl._ssl,
                 )
         enum._test_simple_enum(CheckedOptions, ssl.Options)
 
-
     def test_alertdescription(self):
         CheckedAlertDescription = enum._old_convert_(
                 enum.IntEnum, 'AlertDescription', 'ssl',
@@ -4989,16 +4990,16 @@ def test_alertdescription(self):
         enum._test_simple_enum(CheckedAlertDescription, ssl.AlertDescription)
 
     def test_sslerrornumber(self):
-        Checked_SSLMethod = enum._old_convert_(
-                enum.IntEnum, '_SSLMethod', 'ssl',
-                lambda name: name.startswith('PROTOCOL_') and name != 'PROTOCOL_SSLv23',
+        Checked_SSLErrorNumber = enum._old_convert_(
+                enum.IntEnum, 'SSLErrorNumber', 'ssl',
+                lambda name: name.startswith('SSL_ERROR_'),
                 source=ssl._ssl,
                 )
-        enum._test_simple_enum(Checked_SSLMethod, ssl._SSLMethod)
+        enum._test_simple_enum(Checked_SSLErrorNumber, ssl.SSLErrorNumber)
 
     def test_verifyflags(self):
         CheckedVerifyFlags = enum._old_convert_(
-                enum.FlagEnum, 'VerifyFlags', 'ssl',
+                enum.IntFlag, 'VerifyFlags', 'ssl',
                 lambda name: name.startswith('VERIFY_'),
                 source=ssl._ssl,
                 )
@@ -5012,6 +5013,7 @@ def test_verifymode(self):
                 )
         enum._test_simple_enum(CheckedVerifyMode, ssl.VerifyMode)
 
+
 def test_main(verbose=False):
     if support.verbose:
         plats = {
@@ -5046,7 +5048,7 @@ def test_main(verbose=False):
     tests = [
         ContextTests, BasicSocketTests, SSLErrorTests, MemoryBIOTests,
         SSLObjectTests, SimpleBackgroundTests, ThreadedTests,
-        TestPostHandshakeAuth, TestSSLDebug
+        TestPostHandshakeAuth, TestSSLDebug, TestEnumerations,
     ]
 
     if support.is_resource_enabled('network'):
diff --git a/Misc/NEWS.d/next/Tests/2021-09-14-14-54-04.bpo-45185.qFx5I6.rst b/Misc/NEWS.d/next/Tests/2021-09-14-14-54-04.bpo-45185.qFx5I6.rst
new file mode 100644
index 0000000000000..e723f24759e9e
--- /dev/null
+++ b/Misc/NEWS.d/next/Tests/2021-09-14-14-54-04.bpo-45185.qFx5I6.rst
@@ -0,0 +1 @@
+Enables ``TestEnumerations`` test cases in ``test_ssl`` suite.



More information about the Python-checkins mailing list