コード例 #1
0
 def testPutEnv(self):
     "Put an environment variable and ensure that spawned processes see the change"
     value = "Value we set"
     os.putenv("NEWVARIABLE", value)
     newValue = os.popen("echo $NEWVARIABLE").read().strip()
     if newValue == "$NEWVARIABLE":
         newValue = os.popen("echo %NEWVARIABLE%").read().strip()
     if newValue == "%NEWVARIABLE%":
         raise test_support.TestSkipped(
             "Unable to find a subshell to execute echo")
     assert newValue == value, ("Expected (%s) to equal value we set (%s)" %
                                (newValue, value))
コード例 #2
0
ファイル: test_socket_ssl.py プロジェクト: sjb8100/UTM-Demo
# Test just the SSL support in the socket module, in a moderately bogus way.

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()
コード例 #3
0
ファイル: test_socket_ssl.py プロジェクト: mcyril/ravel-ftn
# Test just the SSL support in the socket module, in a moderately bogus way.
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()