Skip to content

Commit 64d9bc1

Browse files
authored
Remove unsupported Python 3.5 type hints (#303)
Tuple, Dict, List and Optional not supported in Python 3.5, so we can't use them. Using them breaks MacOS workflows.
1 parent 0cbb737 commit 64d9bc1

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

tests/softhsm_setup.py

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,24 +11,23 @@
1111
import tempfile
1212
import traceback
1313
import unittest
14-
from typing import Dict, List, Optional, Tuple
1514

1615
DATA_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

9796
openssl_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

104103
def _temp_file() -> str:

0 commit comments

Comments
 (0)