From 8289ae8195b0c5e14146e230c232671b8799bc46 Mon Sep 17 00:00:00 2001 From: Quentin Pradet Date: Sat, 9 May 2020 22:21:22 +0400 Subject: [PATCH 1/4] Skip hanging test on PyPy3 --- test/__init__.py | 13 +++++++++++++ test/with_dummyserver/test_socketlevel.py | 2 ++ 2 files changed, 15 insertions(+) diff --git a/test/__init__.py b/test/__init__.py index d93330aa..45b72bfb 100644 --- a/test/__init__.py +++ b/test/__init__.py @@ -105,6 +105,19 @@ def wrapper(*args, **kwargs): return wrapper +def skipPyPy3(test): + """Skips this test on PyPy3""" + + @six.wraps(test) + def wrapper(*args, **kwargs): + if platform.python_implementation() == "PyPy" and sys.version_info[0] == 3: + msg = "{} hangs on PyPy3".format(test.__name__) + pytest.skip(msg) + return test(*args, **kwargs) + + return wrapper + + def onlyBrotlipy(): return pytest.mark.skipif(brotli is None, reason="only run if brotlipy is present") diff --git a/test/with_dummyserver/test_socketlevel.py b/test/with_dummyserver/test_socketlevel.py index b8db09f2..66fb5f37 100644 --- a/test/with_dummyserver/test_socketlevel.py +++ b/test/with_dummyserver/test_socketlevel.py @@ -17,6 +17,7 @@ from hip.util.retry import Retry from hip._collections import HTTPHeaderDict +from test import skipPyPy3 from dummyserver.testcase import SocketDummyServerTestCase, consume_socket from dummyserver.server import ( DEFAULT_CERTS, @@ -1287,6 +1288,7 @@ def socket_handler(listener): finally: timed_out.set() + @skipPyPy3 def test_ssl_failed_fingerprint_verification(self): def socket_handler(listener): for i in range(2): From 346ac8a1c24913e0c3ede848973afdc6fadf2e9c Mon Sep 17 00:00:00 2001 From: Quentin Pradet Date: Mon, 11 May 2020 10:56:29 +0400 Subject: [PATCH 2/4] Try harder at uploading coverage The Codecov code handles retries correctly, but the GitHub Actions sometimes fails to fetch it. Trio has found a way to fetch the code that works reliably, so let's use it. --- .github/workflows/ci.yml | 23 +++++++---------------- _travis/upload_coverage.sh | 19 ++++++++++++++++--- 2 files changed, 23 insertions(+), 19 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fe163731..634f6f53 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -84,14 +84,9 @@ jobs: run: | nox -s test-${{ matrix.python-version }} - name: Upload Coverage - uses: codecov/codecov-action@v1 - with: - token: 3bb38a90-137e-4efe-9627-ca66de472c13 - file: ./coverage.xml - flags: unittests - name: codecov-umbrella - yml: ./codecov.yml - fail_ci_if_error: true + run: ./_travis/upload_coverage.sh + env: + JOB_NAME: 'macOS (${{ matrix.python-version }})' Windows: runs-on: windows-latest @@ -122,11 +117,7 @@ jobs: run: | nox -s test-${{ matrix.python-version }} - name: Upload Coverage - uses: codecov/codecov-action@v1 - with: - token: 3bb38a90-137e-4efe-9627-ca66de472c13 - file: ./coverage.xml - flags: unittests - name: codecov-umbrella - yml: ./codecov.yml - fail_ci_if_error: true + run: ./_travis/upload_coverage.sh + shell: bash + env: + JOB_NAME: 'Windows (${{ matrix.python-version }})' diff --git a/_travis/upload_coverage.sh b/_travis/upload_coverage.sh index 9e803d25..b663b7a6 100755 --- a/_travis/upload_coverage.sh +++ b/_travis/upload_coverage.sh @@ -2,7 +2,20 @@ set -exo pipefail -if [[ -e .coverage ]]; then - python -m pip install codecov - python -m codecov --env TRAVIS_OS_NAME,NOX_SESSION +# Cribbed from Trio's ci.sh +function curl-harder() { + for BACKOFF in 0 1 2 4 8 15 15 15 15; do + sleep $BACKOFF + if curl -fL --connect-timeout 5 "$@"; then + return 0 + fi + done + return 1 +} + +if [ "$JOB_NAME" = "" ]; then + JOB_NAME="${TRAVIS_OS_NAME}-${TRAVIS_PYTHON_VERSION:-unknown}" fi + +curl-harder -o codecov.sh https://codecov.io/bash +bash codecov.sh -f coverage.xml -n "${JOB_NAME}" From 00622995f234e40ad0059d05cb43d92e610a14c4 Mon Sep 17 00:00:00 2001 From: Quentin Pradet Date: Mon, 11 May 2020 11:41:58 +0400 Subject: [PATCH 3/4] Bump coverage to avoid empty lines in reports --- dev-requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev-requirements.txt b/dev-requirements.txt index ac493ac9..726e0724 100644 --- a/dev-requirements.txt +++ b/dev-requirements.txt @@ -1,5 +1,5 @@ mock==3.0.5 -coverage~=4.5 +coverage~=5.1 tornado==5.1.1 PySocks==1.7.1 # https://github.com/Anorov/PySocks/issues/131 From 0161a46e432184f39c7429615d7f175acef6ab4e Mon Sep 17 00:00:00 2001 From: Quentin Pradet Date: Mon, 11 May 2020 13:32:20 +0400 Subject: [PATCH 4/4] Rename _travis/ to ci/ --- .github/workflows/ci.yml | 4 ++-- .travis.yml | 6 +++--- {_travis => ci}/deploy.sh | 0 {_travis => ci}/install.sh | 0 {_travis => ci}/run.sh | 0 {_travis => ci}/upload_coverage.sh | 0 6 files changed, 5 insertions(+), 5 deletions(-) rename {_travis => ci}/deploy.sh (100%) rename {_travis => ci}/install.sh (100%) rename {_travis => ci}/run.sh (100%) rename {_travis => ci}/upload_coverage.sh (100%) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 634f6f53..a68020af 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -84,7 +84,7 @@ jobs: run: | nox -s test-${{ matrix.python-version }} - name: Upload Coverage - run: ./_travis/upload_coverage.sh + run: ./ci/upload_coverage.sh env: JOB_NAME: 'macOS (${{ matrix.python-version }})' @@ -117,7 +117,7 @@ jobs: run: | nox -s test-${{ matrix.python-version }} - name: Upload Coverage - run: ./_travis/upload_coverage.sh + run: ./ci/upload_coverage.sh shell: bash env: JOB_NAME: 'Windows (${{ matrix.python-version }})' diff --git a/.travis.yml b/.travis.yml index aa3abe13..38283e91 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,11 +8,11 @@ before_install: - python -c "import ssl; print(ssl.OPENSSL_VERSION)" install: - - ./_travis/install.sh + - ./ci/install.sh script: - - ./_travis/run.sh - - ./_travis/upload_coverage.sh + - ./ci/run.sh + - ./ci/upload_coverage.sh cache: directories: diff --git a/_travis/deploy.sh b/ci/deploy.sh similarity index 100% rename from _travis/deploy.sh rename to ci/deploy.sh diff --git a/_travis/install.sh b/ci/install.sh similarity index 100% rename from _travis/install.sh rename to ci/install.sh diff --git a/_travis/run.sh b/ci/run.sh similarity index 100% rename from _travis/run.sh rename to ci/run.sh diff --git a/_travis/upload_coverage.sh b/ci/upload_coverage.sh similarity index 100% rename from _travis/upload_coverage.sh rename to ci/upload_coverage.sh