From 79e063f689d2c0b6bedf6aaf0bac2fcff59091d0 Mon Sep 17 00:00:00 2001 From: Thomas Grainger Date: Tue, 8 Jun 2021 12:57:45 +0100 Subject: [PATCH 1/6] test on py 3.10 --- .github/workflows/ci.yml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) 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 From e77ac035d6af863553a2070a0b2249e7617d7891 Mon Sep 17 00:00:00 2001 From: Thomas Grainger Date: Tue, 8 Jun 2021 13:16:33 +0100 Subject: [PATCH 2/6] py3.10 needs a new version of pytest --- ci.sh | 6 +++- test-requirements-py3.txt | 63 +++++++++++++++++++++++++++++++++++++++ test-requirements.in | 8 ++--- test-requirements.txt | 35 ++++++++++++++++++---- 4 files changed, 102 insertions(+), 10 deletions(-) create mode 100644 test-requirements-py3.txt diff --git a/ci.sh b/ci.sh index ca76fef..fff5959 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 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 From 496dca6f2146268058b300a7fc24d4bdb90c5c33 Mon Sep 17 00:00:00 2001 From: Thomas Grainger Date: Tue, 8 Jun 2021 14:13:24 +0100 Subject: [PATCH 3/6] close the wrapped sockets to prevent Unraisable ResourceWarnings --- tests/test_trustme.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/test_trustme.py b/tests/test_trustme.py index 68d61e6..754af7e 100644 --- a/tests/test_trustme.py +++ b/tests/test_trustme.py @@ -258,6 +258,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 @@ -271,6 +272,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 From c1e7923784e3282aa63c28a1afe2c7960d80390f Mon Sep 17 00:00:00 2001 From: Thomas Grainger Date: Tue, 8 Jun 2021 15:03:41 +0100 Subject: [PATCH 4/6] require codecov in ci --- ci.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci.sh b/ci.sh index fff5959..257e996 100755 --- a/ci.sh +++ b/ci.sh @@ -26,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 --required -F $(uname | tr A-Z a-z) From 53e121d4f2746333cedb412cabd510549e677ba6 Mon Sep 17 00:00:00 2001 From: Thomas Grainger Date: Tue, 8 Jun 2021 15:07:45 +0100 Subject: [PATCH 5/6] try codecov harder --- ci.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci.sh b/ci.sh index 257e996..4039ecc 100755 --- a/ci.sh +++ b/ci.sh @@ -26,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 --required -F $(uname | tr A-Z a-z) +codecov --tries=100 --required -F $(uname | tr A-Z a-z) From 034fb3aad7890ac6e4cb24d821413bd790a84b35 Mon Sep 17 00:00:00 2001 From: Thomas Grainger Date: Tue, 8 Jun 2021 15:39:38 +0100 Subject: [PATCH 6/6] retry codecov more --- ci.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci.sh b/ci.sh index 4039ecc..4a4dc3e 100755 --- a/ci.sh +++ b/ci.sh @@ -26,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 --tries=100 --required -F $(uname | tr A-Z a-z) +codecov --tries=9999 --required -F $(uname | tr A-Z a-z)