1 # Convenience test module to run all of the OpenSSL-related tests in the 2 # standard library. 3 4 import ssl 5 import sys 6 import subprocess 7 8 TESTS = [ 9 'test_ensurepip.py', 'test_ftplib', 'test_hashlib', 10 'test_hmac', 'test_httplib', 'test_imaplib', 'test_nntplib', 11 'test_poplib', 'test_ssl', 'test_smtplib', 'test_smtpnet', 12 'test_urllib2_localnet', 'test_xmlrpc' 13 ] 14 15 def run_regrtests(*extra_args): 16 print(ssl.OPENSSL_VERSION) 17 args = [ 18 sys.executable, 19 '-Werror', '-bb', # turn warnings into exceptions 20 '-m', 'test.regrtest', 21 ] 22 if not extra_args: 23 args.extend([ 24 '-r', # randomize 25 '-w', # re-run failed tests with -v 26 '-u', 'network', # use network 27 '-u', 'urlfetch', # download test vectors 28 ]) 29 else: 30 args.extend(extra_args) 31 args.extend(TESTS) 32 result = subprocess.call(args) 33 sys.exit(result) 34 35 if __name__ == '__main__': 36 run_regrtests(*sys.argv[1:]) 37