66import sys
77import unittest
88from base64 import b64decode , b64encode
9+ from concurrent .futures import ThreadPoolExecutor
910from dataclasses import replace
1011from glob import glob
1112from xml .etree import ElementTree as stdlibElementTree
@@ -113,7 +114,7 @@ def test_basic_signxml_statements(self):
113114 self .assertEqual (SignatureMethod .RSA_SHA256 .value , "http://www.w3.org/2001/04/xmldsig-more#rsa-sha256" )
114115 self .assertEqual (SignatureConstructionMethod .enveloped , methods .enveloped )
115116 with self .assertRaisesRegex (InvalidInput , "Unknown signature construction method" ):
116- signer = XMLSignerWithSHA1 (method = None )
117+ XMLSignerWithSHA1 (method = None )
117118
118119 with self .assertRaisesRegex (InvalidInput , "must be an XML element" ):
119120 XMLSigner (signature_algorithm = "hmac-sha256" ).sign ("x" , key = b"abc" )
@@ -125,8 +126,8 @@ def test_basic_signxml_statements(self):
125126 "http://www.w3.org/2001/10/xml-exc-c14n#WithComments" ,
126127 }
127128
128- all_methods = itertools . product ( digest_algs , sig_algs , methods , c14n_algs )
129- for digest_alg , sig_alg , method , c14n_alg in all_methods :
129+ def test_case ( case ):
130+ digest_alg , sig_alg , method , c14n_alg = case
130131 data = [etree .parse (f ).getroot () for f in self .example_xml_files ]
131132 # FIXME: data.extend(stdlibElementTree.parse(f).getroot() for f in (self.example_xml_files)
132133 data .append (stdlibElementTree .parse (self .example_xml_files [0 ]).getroot ())
@@ -214,6 +215,10 @@ def resolver(uri):
214215 verify_kwargs ["hmac_key" ] = b"SECRET"
215216 XMLVerifier ().verify (signed_data , ** verify_kwargs )
216217
218+ executor = ThreadPoolExecutor ()
219+ for _ in executor .map (test_case , itertools .product (digest_algs , sig_algs , methods , c14n_algs )):
220+ pass
221+
217222 def test_x509_certs (self ):
218223 from OpenSSL .crypto import FILETYPE_PEM
219224 from OpenSSL .crypto import Error as OpenSSLCryptoError
0 commit comments