Skip to content

Commit

Permalink
Remove more type hinting
Browse files Browse the repository at this point in the history
  • Loading branch information
mxamin committed Apr 5, 2024
1 parent 4198d75 commit b218ce3
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions tests/softhsm_setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,24 +11,23 @@
import tempfile
import traceback
import unittest
from typing import Dict, List, Optional, Tuple

DATA_DIR = os.path.join(os.path.dirname(__file__), "data")


def paths_for_component(component: str, default_paths: List[str]):
def paths_for_component(component: str, default_paths):
env_path = os.environ.get(component)
return [env_path] if env_path else default_paths


def find_alts(component_name, alts: List[str]) -> str:
def find_alts(component_name, alts) -> str:
for a in alts:
if os.path.exists(a):
return a
raise unittest.SkipTest("Required component is missing: {}".format(component_name))


def run_cmd(args, softhsm_conf=None) -> Tuple[bytes, bytes]:
def run_cmd(args, softhsm_conf=None):
env = {}
if softhsm_conf is not None:
env['SOFTHSM_CONF'] = softhsm_conf
Expand Down Expand Up @@ -85,7 +84,7 @@ def run_cmd(args, softhsm_conf=None) -> Tuple[bytes, bytes]:
],
}

component_path: Dict[str, str] = {
component_path = {
component_name: find_alts(component_name, paths_for_component(component_name, default_paths))
for component_name, default_paths in component_default_paths.items()
}
Expand All @@ -96,9 +95,9 @@ def run_cmd(args, softhsm_conf=None) -> Tuple[bytes, bytes]:

openssl_version = subprocess.check_output([component_path['OPENSSL'], 'version'])[8:11].decode()

p11_test_files: List[str] = []
softhsm_conf: Optional[str] = None
softhsm_db: Optional[str] = None
p11_test_files = []
softhsm_conf = None
softhsm_db = None


def _temp_file() -> str:
Expand Down

0 comments on commit b218ce3

Please sign in to comment.