blob: 5073ae12204b1642b5bfbdb33bdb97ff90f58ef2 [file] [log] [blame]
Christian Heimes55b196a2016-09-22 16:49:35 +02001# Convenience test module to run all of the OpenSSL-related tests in the
Christian Heimesc6d471d2013-12-05 07:45:36 +01002# standard library.
3
Christian Heimes55b196a2016-09-22 16:49:35 +02004import ssl
Christian Heimesc6d471d2013-12-05 07:45:36 +01005import sys
6import subprocess
7
Christian Heimes55b196a2016-09-22 16:49:35 +02008TESTS = [
9 'test_asyncio', '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_venv', 'test_xmlrpc'
13]
Christian Heimesc6d471d2013-12-05 07:45:36 +010014
15def run_regrtests(*extra_args):
Christian Heimes55b196a2016-09-22 16:49:35 +020016 print(ssl.OPENSSL_VERSION)
17 args = [
18 sys.executable,
19 '-Werror', '-bb', # turn warnings into exceptions
20 '-m', 'test',
21 ]
Christian Heimesc6d471d2013-12-05 07:45:36 +010022 if not extra_args:
Christian Heimes55b196a2016-09-22 16:49:35 +020023 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 '-j', '0' # use multiple CPUs
29 ])
Christian Heimesc6d471d2013-12-05 07:45:36 +010030 else:
31 args.extend(extra_args)
32 args.extend(TESTS)
33 result = subprocess.call(args)
34 sys.exit(result)
35
36if __name__ == '__main__':
37 run_regrtests(*sys.argv[1:])