diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fe163731..a68020af 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: ./ci/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: ./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/upload_coverage.sh b/_travis/upload_coverage.sh deleted file mode 100755 index 9e803d25..00000000 --- a/_travis/upload_coverage.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/bash - -set -exo pipefail - -if [[ -e .coverage ]]; then - python -m pip install codecov - python -m codecov --env TRAVIS_OS_NAME,NOX_SESSION -fi 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/ci/upload_coverage.sh b/ci/upload_coverage.sh new file mode 100755 index 00000000..b663b7a6 --- /dev/null +++ b/ci/upload_coverage.sh @@ -0,0 +1,21 @@ +#!/bin/bash + +set -exo pipefail + +# 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}" 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 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):