Skip to content
This repository has been archived by the owner on Apr 14, 2022. It is now read-only.

Improve CI reliability #219

Merged
merged 4 commits into from
May 11, 2020
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 7 additions & 16 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a suggestion, we should put our CI script like upload_coverage.sh in a folder maybe named ci.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@RatanShreshtha I renamed _travis/ to ci/, please take another look

env:
JOB_NAME: 'macOS (${{ matrix.python-version }})'

Windows:
runs-on: windows-latest
Expand Down Expand Up @@ -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 }})'
19 changes: 16 additions & 3 deletions _travis/upload_coverage.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
2 changes: 1 addition & 1 deletion dev-requirements.txt
Original file line number Diff line number Diff line change
@@ -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
Expand Down
13 changes: 13 additions & 0 deletions test/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Expand Down
2 changes: 2 additions & 0 deletions test/with_dummyserver/test_socketlevel.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -1287,6 +1288,7 @@ def socket_handler(listener):
finally:
timed_out.set()

@skipPyPy3
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎉

def test_ssl_failed_fingerprint_verification(self):
def socket_handler(listener):
for i in range(2):
Expand Down