diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5549b8a..79689a8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,8 +14,7 @@ jobs: strategy: fail-fast: false matrix: - # Add 3.9 when cryptography ships Python 3.9 Windows wheels - python: ['2.7', '3.6', '3.7', '3.8'] + python: ['2.7', '3.6', '3.7', '3.8', '3.9', '3.10.0-beta.2'] steps: - name: Checkout uses: actions/checkout@v2 @@ -37,7 +36,7 @@ jobs: strategy: fail-fast: false matrix: - python: ['2.7', '3.6', '3.7', '3.8', '3.9'] + python: ['2.7', '3.6', '3.7', '3.8', '3.9', '3.10.0-beta.2'] old_cryptography: [''] extra_name: [''] include: @@ -71,7 +70,7 @@ jobs: strategy: fail-fast: false matrix: - python: ['2.7', '3.6', '3.7', '3.8', '3.9'] + python: ['2.7', '3.6', '3.7', '3.8', '3.9', '3.10.0-beta.2'] steps: - name: Checkout uses: actions/checkout@v2 diff --git a/ci.sh b/ci.sh index ca76fef..4a4dc3e 100755 --- a/ci.sh +++ b/ci.sh @@ -12,7 +12,11 @@ python -m pip install dist/*.zip # Actual tests -python -m pip install -Ur test-requirements.txt +if [[ $(python -c 'import sys; print(sys.version_info < (3,))') = 'True' ]]; then + python -m pip install -Ur test-requirements.txt +else + python -m pip install -Ur test-requirements-py3.txt +fi if [ -n "${OLD_CRYPTOGRAPHY:-}" ]; then python -m pip install cryptography=="${OLD_CRYPTOGRAPHY}" fi @@ -22,4 +26,4 @@ INSTALLDIR=$(python -c "import os, trustme; print(os.path.dirname(trustme.__file pytest -W error -ra -s ../tests --cov="$INSTALLDIR" --cov=../tests --cov-config="../.coveragerc" python -m pip install codecov -codecov -F $(uname | tr A-Z a-z) +codecov --tries=9999 --required -F $(uname | tr A-Z a-z) diff --git a/test-requirements-py3.txt b/test-requirements-py3.txt new file mode 100644 index 0000000..60a07c8 --- /dev/null +++ b/test-requirements-py3.txt @@ -0,0 +1,63 @@ +# +# This file is autogenerated by pip-compile +# To update, run: +# +# pip-compile --output-file=test-requirements-py3.txt test-requirements.in +# +attrs==21.2.0 + # via + # pytest + # service-identity +cffi==1.14.5 + # via cryptography +coverage==5.5 + # via pytest-cov +cryptography==3.4.7 + # via + # -r test-requirements.in + # pyopenssl + # service-identity +importlib-metadata==4.5.0 + # via + # pluggy + # pytest +iniconfig==1.1.1 + # via pytest +packaging==20.9 + # via pytest +pluggy==0.13.1 + # via pytest +py==1.10.0 + # via pytest +pyasn1-modules==0.2.8 + # via service-identity +pyasn1==0.4.8 + # via + # pyasn1-modules + # service-identity +pycparser==2.20 + # via cffi +pyopenssl==20.0.1 + # via -r test-requirements.in +pyparsing==2.4.7 + # via packaging +pytest-cov==2.12.1 + # via -r test-requirements.in +pytest==6.2.4 + # via + # -r test-requirements.in + # pytest-cov +service-identity==21.1.0 + # via -r test-requirements.in +six==1.16.0 + # via + # pyopenssl + # service-identity +toml==0.10.2 + # via + # pytest + # pytest-cov +typing-extensions==3.10.0.0 + # via importlib-metadata +zipp==3.4.1 + # via importlib-metadata diff --git a/test-requirements.in b/test-requirements.in index b72e839..9abd93a 100644 --- a/test-requirements.in +++ b/test-requirements.in @@ -6,10 +6,10 @@ cryptography # Those are the last version with py2 support # and pip-compile won't let us pin it just on py2, so we have to pin it # everywhere -more-itertools==5.0.0 -zipp<2.0 -idna<3 +more-itertools==5.0.0; python_version < "3" +zipp<2.0; python_version < "3" +idna<3; python_version < "3" # Really only needed on py2, but again, pip-compile doesn't handle # environment markers well, so we install it everywhere and on py3 it # just doesn't get used. -futures +futures; python_version < "3.2" diff --git a/test-requirements.txt b/test-requirements.txt index ca462ef..c1eceb7 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -10,8 +10,16 @@ attrs==21.2.0 # via # pytest # service-identity +backports.functools-lru-cache==1.6.4 + # via wcwidth cffi==1.14.5 # via cryptography +configparser==4.0.2 + # via importlib-metadata +contextlib2==0.6.0.post1 + # via + # importlib-metadata + # zipp coverage==5.5 # via pytest-cov cryptography==2.9.2 @@ -19,18 +27,32 @@ cryptography==2.9.2 # -r test-requirements.in # pyopenssl # service-identity -futures==3.1.1 +enum34==1.1.10 + # via cryptography +funcsigs==1.0.2 + # via pytest +futures==3.1.1 ; python_version < "3.2" # via -r test-requirements.in -idna==2.10 +idna==2.10 ; python_version < "3" # via -r test-requirements.in importlib-metadata==2.0.0 - # via pytest -more-itertools==5.0.0 + # via + # pluggy + # pytest +ipaddress==1.0.23 + # via + # cryptography + # service-identity +more-itertools==5.0.0 ; python_version < "3" # via # -r test-requirements.in # pytest packaging==20.9 # via pytest +pathlib2==2.3.5 + # via + # importlib-metadata + # pytest pluggy==0.13.1 # via pytest py==1.10.0 @@ -53,12 +75,15 @@ pytest==4.6.3 # via # -r test-requirements.in # pytest-cov +scandir==1.10.0 + # via pathlib2 service-identity==21.1.0 # via -r test-requirements.in six==1.16.0 # via # cryptography # more-itertools + # pathlib2 # pyopenssl # pytest # service-identity @@ -66,7 +91,7 @@ toml==0.10.2 # via pytest-cov wcwidth==0.2.5 # via pytest -zipp==1.2.0 +zipp==1.2.0 ; python_version < "3" # via # -r test-requirements.in # importlib-metadata diff --git a/tests/test_trustme.py b/tests/test_trustme.py index fb5137f..23d9229 100644 --- a/tests/test_trustme.py +++ b/tests/test_trustme.py @@ -276,6 +276,7 @@ def fake_ssl_client(ca, raw_client_sock, hostname): # Send and receive some data to prove the connection is good wrapped_client_sock.send(b"x") assert wrapped_client_sock.recv(1) == b"y" + wrapped_client_sock.close() except: # pragma: no cover sys.excepthook(*sys.exc_info()) raise @@ -289,6 +290,7 @@ def fake_ssl_server(server_cert, raw_server_sock): # Prove that we're connected assert wrapped_server_sock.recv(1) == b"x" wrapped_server_sock.send(b"y") + wrapped_server_sock.close() except: # pragma: no cover sys.excepthook(*sys.exc_info()) raise