| 
									
										
										
										
											2016-09-22 16:49:35 +02:00
										 |  |  | # Convenience test module to run all of the OpenSSL-related tests in the | 
					
						
							| 
									
										
										
										
											2013-12-05 07:45:36 +01:00
										 |  |  | # standard library. | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-09-22 16:49:35 +02:00
										 |  |  | import ssl | 
					
						
							| 
									
										
										
										
											2013-12-05 07:45:36 +01:00
										 |  |  | import sys | 
					
						
							|  |  |  | import subprocess | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-09-22 16:49:35 +02:00
										 |  |  | TESTS = [ | 
					
						
							|  |  |  |     'test_asyncio', 'test_ensurepip.py', 'test_ftplib', 'test_hashlib', | 
					
						
							| 
									
										
										
										
											2023-05-24 23:15:43 +02:00
										 |  |  |     'test_hmac', 'test_httplib', 'test_imaplib', | 
					
						
							| 
									
										
										
										
											2016-09-22 16:49:35 +02:00
										 |  |  |     'test_poplib', 'test_ssl', 'test_smtplib', 'test_smtpnet', | 
					
						
							|  |  |  |     'test_urllib2_localnet', 'test_venv', 'test_xmlrpc' | 
					
						
							|  |  |  | ] | 
					
						
							| 
									
										
										
										
											2013-12-05 07:45:36 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | def run_regrtests(*extra_args): | 
					
						
							| 
									
										
										
										
											2016-09-22 16:49:35 +02:00
										 |  |  |     print(ssl.OPENSSL_VERSION) | 
					
						
							|  |  |  |     args = [ | 
					
						
							|  |  |  |         sys.executable, | 
					
						
							| 
									
										
										
										
											2021-05-01 13:53:57 -07:00
										 |  |  |         '-Werror', '-bb',  # turn warnings into exceptions | 
					
						
							| 
									
										
										
										
											2016-09-22 16:49:35 +02:00
										 |  |  |         '-m', 'test', | 
					
						
							|  |  |  |     ] | 
					
						
							| 
									
										
										
										
											2013-12-05 07:45:36 +01:00
										 |  |  |     if not extra_args: | 
					
						
							| 
									
										
										
										
											2016-09-22 16:49:35 +02:00
										 |  |  |         args.extend([ | 
					
						
							|  |  |  |             '-r',  # randomize | 
					
						
							|  |  |  |             '-w',  # re-run failed tests with -v | 
					
						
							|  |  |  |             '-u', 'network',  # use network | 
					
						
							|  |  |  |             '-u', 'urlfetch',  # download test vectors | 
					
						
							|  |  |  |             '-j', '0'  # use multiple CPUs | 
					
						
							|  |  |  |         ]) | 
					
						
							| 
									
										
										
										
											2013-12-05 07:45:36 +01:00
										 |  |  |     else: | 
					
						
							|  |  |  |         args.extend(extra_args) | 
					
						
							|  |  |  |     args.extend(TESTS) | 
					
						
							|  |  |  |     result = subprocess.call(args) | 
					
						
							|  |  |  |     sys.exit(result) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | if __name__ == '__main__': | 
					
						
							|  |  |  |     run_regrtests(*sys.argv[1:]) |