ssltests.py 1.0 KB

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