FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Remove unsupported type hints by mxamin · Pull Request #303 · xmlsec/python-xmlsec · GitHub

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .py  (1) All 1 file type selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
17 changes: 8 additions & 9 deletions tests/softhsm_setup.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
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 All @@ -55,7 +54,7 @@ def run_cmd(args, softhsm_conf=None) -> Tuple[bytes, bytes]:
return out, err


component_default_paths: Dict[str, List[str]] = {
component_default_paths = {
'P11_MODULE': [
'/usr/lib/softhsm/libsofthsm2.so',
'/usr/lib/x86_64-linux-gnu/softhsm/libsofthsm2.so',
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

Back | FazBrowse Home | New Git URL