Skip to content

Commit

Permalink
Attempted fix of importlib
Browse files Browse the repository at this point in the history
  • Loading branch information
hbldh committed Apr 29, 2024
1 parent ccaa74c commit dde93ec
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build_and_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest]
python-version: [3.9, '3.10', '3.11', '3.12']
python-version: [3.7, 3.8, 3.9, '3.10', '3.11', '3.12']
steps:
- uses: actions/checkout@v4

Expand Down
8 changes: 6 additions & 2 deletions bankid/certutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,15 @@
"""

import os
import sys
import subprocess
from typing import Tuple, Union

import pathlib
import importlib.resources
if sys.version_info < (3, 9):
import importlib_resources as impres
else:
import importlib.resources as impres

from bankid.certs import get_test_cert_p12
from bankid.exceptions import BankIDError
Expand All @@ -19,7 +23,7 @@


def resolve_cert_path(file: str) -> pathlib.Path:
path = importlib.resources.files("bankid.certs").joinpath(file)
path = impres.files("bankid.certs").joinpath(file)
assert isinstance(path, pathlib.Path)
return path

Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
httpx
importlib_resources; python_version < "3.9"

0 comments on commit dde93ec

Please sign in to comment.