mirror of
https://github.com/python/cpython.git
synced 2025-07-14 14:55:17 +00:00

imports e.g. test_support must do so using an absolute package name such as "import test.test_support" or "from test import test_support". This also updates the README in Lib/test, and gets rid of the duplicate data dirctory in Lib/test/data (replaced by Lib/email/test/data). Now Tim and Jack can have at it. :)
27 lines
687 B
Python
27 lines
687 B
Python
# Test just the SSL support in the socket module, in a moderately bogus way.
|
|
|
|
from test import test_support
|
|
|
|
# Optionally test SSL support. This currently requires the 'network' resource
|
|
# as given on the regrtest command line. If not available, nothing after this
|
|
# line will be executed.
|
|
test_support.requires('network')
|
|
|
|
import socket
|
|
if not hasattr(socket, "ssl"):
|
|
raise test_support.TestSkipped("socket module has no ssl support")
|
|
|
|
import urllib
|
|
|
|
socket.RAND_status()
|
|
try:
|
|
socket.RAND_egd(1)
|
|
except TypeError:
|
|
pass
|
|
else:
|
|
print "didn't raise TypeError"
|
|
socket.RAND_add("this is a random string", 75.0)
|
|
|
|
f = urllib.urlopen('https://sf.net')
|
|
buf = f.read()
|
|
f.close()
|