1111import tempfile
1212import traceback
1313import unittest
14- from typing import Dict , List , Optional , Tuple
1514
1615DATA_DIR = os .path .join (os .path .dirname (__file__ ), 'data' )
1716
1817
19- def paths_for_component (component : str , default_paths : List [ str ] ):
18+ def paths_for_component (component : str , default_paths ):
2019 env_path = os .environ .get (component )
2120 return [env_path ] if env_path else default_paths
2221
2322
24- def find_alts (component_name , alts : List [ str ] ) -> str :
23+ def find_alts (component_name , alts ) -> str :
2524 for a in alts :
2625 if os .path .exists (a ):
2726 return a
2827 raise unittest .SkipTest ('Required component is missing: {}' .format (component_name ))
2928
3029
31- def run_cmd (args , softhsm_conf = None ) -> Tuple [ bytes , bytes ] :
30+ def run_cmd (args , softhsm_conf = None ):
3231 env = {}
3332 if softhsm_conf is not None :
3433 env ['SOFTHSM_CONF' ] = softhsm_conf
@@ -55,7 +54,7 @@ def run_cmd(args, softhsm_conf=None) -> Tuple[bytes, bytes]:
5554 return out , err
5655
5756
58- component_default_paths : Dict [ str , List [ str ]] = {
57+ component_default_paths = {
5958 'P11_MODULE' : [
6059 '/usr/lib/softhsm/libsofthsm2.so' ,
6160 '/usr/lib/x86_64-linux-gnu/softhsm/libsofthsm2.so' ,
@@ -85,7 +84,7 @@ def run_cmd(args, softhsm_conf=None) -> Tuple[bytes, bytes]:
8584 ],
8685}
8786
88- component_path : Dict [ str , str ] = {
87+ component_path = {
8988 component_name : find_alts (component_name , paths_for_component (component_name , default_paths ))
9089 for component_name , default_paths in component_default_paths .items ()
9190}
@@ -96,9 +95,9 @@ def run_cmd(args, softhsm_conf=None) -> Tuple[bytes, bytes]:
9695
9796openssl_version = subprocess .check_output ([component_path ['OPENSSL' ], 'version' ])[8 :11 ].decode ()
9897
99- p11_test_files : List [ str ] = []
100- softhsm_conf : Optional [ str ] = None
101- softhsm_db : Optional [ str ] = None
98+ p11_test_files = []
99+ softhsm_conf = None
100+ softhsm_db = None
102101
103102
104103def _temp_file () -> str :
0 commit comments