@@ -369,6 +369,10 @@ Random generation
369369Certificate handling
370370^^^^^^^^^^^^^^^^^^^^
371371
372+ .. testsetup ::
373+
374+ import ssl
375+
372376.. function :: match_hostname(cert, hostname)
373377
374378 Verify that *cert * (in decoded format as returned by
@@ -415,10 +419,10 @@ Certificate handling
415419
416420 >>> import ssl
417421 >>> timestamp = ssl.cert_time_to_seconds(" Jan 5 09:34:43 2018 GMT" )
418- >>> timestamp
422+ >>> timestamp # doctest: +SKIP
419423 1515144883
420424 >>> from datetime import datetime
421- >>> print (datetime.utcfromtimestamp(timestamp))
425+ >>> print (datetime.utcfromtimestamp(timestamp)) # doctest: +SKIP
422426 2018-01-05 09:34:43
423427
424428 "notBefore" or "notAfter" dates must use GMT (:rfc: `5280 `).
@@ -1378,6 +1382,7 @@ to speed up repeated connections from the same clients.
13781382 'strength_bits': 128}]
13791383
13801384 On OpenSSL 1.1 and newer the cipher dict contains additional fields::
1385+
13811386 >>> ctx.get_ciphers() # OpenSSL 1.1+
13821387 [{'aead': True,
13831388 'alg_bits': 256,
@@ -1638,7 +1643,7 @@ to speed up repeated connections from the same clients.
16381643 .. versionchanged :: 3.6
16391644 :attr: `SSLContext.options ` returns :class: `Options ` flags:
16401645
1641- >>> ssl.create_default_context().options
1646+ >>> ssl.create_default_context().options # doctest: +SKIP
16421647 <Options.OP_ALL|OP_NO_SSLv3|OP_NO_SSLv2|OP_NO_COMPRESSION: 2197947391>
16431648
16441649.. attribute :: SSLContext.protocol
@@ -1658,7 +1663,7 @@ to speed up repeated connections from the same clients.
16581663 .. versionchanged :: 3.6
16591664 :attr: `SSLContext.verify_flags ` returns :class: `VerifyFlags ` flags:
16601665
1661- >>> ssl.create_default_context().verify_flags
1666+ >>> ssl.create_default_context().verify_flags # doctest: +SKIP
16621667 <VerifyFlags.VERIFY_X509_TRUSTED_FIRST: 32768>
16631668
16641669.. attribute :: SSLContext.verify_mode
@@ -2259,6 +2264,8 @@ recommended to use :const:`PROTOCOL_TLS_CLIENT` or
22592264:const: `PROTOCOL_TLS_SERVER ` as the protocol version. SSLv2 and SSLv3 are
22602265disabled by default.
22612266
2267+ ::
2268+
22622269 >>> client_context = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)
22632270 >>> client_context.options |= ssl.OP_NO_TLSv1
22642271 >>> client_context.options |= ssl.OP_NO_TLSv1_1
0 commit comments