diff --git a/Lib/test/test_ssl.py b/Lib/test/test_ssl.py index d9e184365ce..556c1cf2792 100644 --- a/Lib/test/test_ssl.py +++ b/Lib/test/test_ssl.py @@ -4969,17 +4969,18 @@ class TestEnumerations(unittest.TestCase): 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 @@ class TestEnumerations(unittest.TestCase): 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 @@ class TestEnumerations(unittest.TestCase): ) 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 00000000000..e723f24759e --- /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.