Skip to content

Commit

Permalink
Test on Windows and macOS
Browse files Browse the repository at this point in the history
  • Loading branch information
sethmlarson authored May 6, 2024
1 parent f6426db commit a418153
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
5 changes: 1 addition & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,7 @@ jobs:
fail-fast: false
matrix:
os: [macos-latest, windows-latest, ubuntu-latest]
python-version: ["3.10", "3.11", "3.12", "pypy3.10"]
include:
- os: ubuntu-latest
python-version: "3.13"
python-version: ["3.10", "3.11", "3.12", "3.13", "pypy3.10"]

runs-on: ${{ matrix.os }}
name: ${{ fromJson('{"macos-latest":"macOS","windows-latest":"Windows","ubuntu-latest":"Ubuntu"}')[matrix.os] }} Python ${{ matrix.python-version }}
Expand Down
5 changes: 3 additions & 2 deletions dev-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ urllib3
requests
flaky
httpx
trustme

# Requires 'cryptography' which doesn't yet support Python 3.13
trustme; python_version < "3.13"
# Temporary stop-gap until cffi supports 3.13
cffi @ https://github.com/python-cffi/cffi/archive/refs/heads/main.zip; python_version > "3.12"
8 changes: 6 additions & 2 deletions src/truststore/_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
import sys
import typing

import _ssl # type: ignore[import-not-found]

from ._ssl_constants import (
_original_SSLContext,
_original_super_SSLContext,
Expand Down Expand Up @@ -279,10 +281,12 @@ def verify_mode(self, value: ssl.VerifyMode) -> None:

def _get_unverified_chain_bytes(sslobj: ssl.SSLObject) -> list[bytes]:
unverified_chain = sslobj.get_unverified_chain() or () # type: ignore[attr-defined]
return [cert for cert in unverified_chain]
return [
cert if isinstance(cert, bytes) else cert.public_bytes(_ssl.ENCODING_DER)
for cert in unverified_chain
]

else:
import _ssl # type: ignore[import-not-found]

def _get_unverified_chain_bytes(sslobj: ssl.SSLObject) -> list[bytes]:
unverified_chain = sslobj.get_unverified_chain() or () # type: ignore[attr-defined]
Expand Down

0 comments on commit a418153

Please sign in to comment.