Remove codecov in favor of GHA artifacts to upload and combine coverage reports
See:
Thanks to Ned for helping with the PR.
MODIFY
.coveragerc
.coveragerc
@@ -11,9 +11,8 @@ omit =
[paths]
source =
src/urllib3
- .tox/*/lib/python*/site-packages/urllib3
- .tox\*\Lib\site-packages\urllib3
- .tox/pypy*/site-packages/urllib3
+ */urllib3
+ *\urllib3
[report]
exclude_lines =

MODIFY
.github/workflows/ci.yml
.github/workflows/ci.yml
@@ -101,9 +101,32 @@ jobs:
- name: Upload Coverage
if: ${{ matrix.nox-session != 'unsupported_python2' }}
- uses: codecov/codecov-action@v2
+ uses: "actions/upload-artifact@v2"
with:
- fail_ci_if_error: true
- name: "${{ runner.os }} (${{ matrix.python-version }})"
- files: ./coverage.xml
- verbose: true
+ name: coverage-data
+ path: ".coverage.*"
+ if-no-files-found: error
+
+
+ coverage:
+ runs-on: "ubuntu-latest"
+ needs: test
+ steps:
+ - uses: actions/checkout@v2
+ - name: "Use latest Python so it understands all syntax"
+ uses: actions/setup-python@v2
+ with:
+ python-version: "3.10"
+
+ - name: "Install coverage"
+ run: "python -m pip install --upgrade coverage"
+
+ - name: "Download coverage data"
+ uses: actions/download-artifact@v2
+ with:
+ name: coverage-data
+
+ - name: "Combine & check coverage"
+ run: |
+ python -m coverage combine
+ python -m coverage report -i --fail-under=100

MODIFY
dev-requirements.txt
dev-requirements.txt
-coverage==6.0
+coverage==6.2
tornado==6.1
PySocks==1.7.1
pytest==6.2.5

MODIFY
noxfile.py
noxfile.py
@@ -31,11 +31,8 @@ def tests_impl(
# Print OpenSSL information.
session.run("python", "-m", "OpenSSL.debug")
- # Inspired from https://github.com/pyca/cryptography
- # We use parallel mode and then combine here so that coverage.py will take
- # the paths like .tox/pyXY/lib/pythonX.Y/site-packages/urllib3/__init__.py
- # and collapse them into src/urllib3/__init__.py.
-
+ # Inspired from https://hynek.me/articles/ditch-codecov-python/
+ # We use parallel mode and then combine in a later CI step
session.run(
"python",
*(("-bb",) if byte_string_comparisons else ()),
@@ -47,14 +44,12 @@ def tests_impl(
"pytest",
"-r",
"a",
+ f"--color={'yes' if 'GITHUB_ACTIONS' in os.environ else 'auto'}",
"--tb=native",
"--no-success-flaky-report",
*(session.posargs or ("test/",)),
env={"PYTHONWARNINGS": "always::DeprecationWarning"},
)
- session.run("coverage", "combine")
- session.run("coverage", "report", "-m")
- session.run("coverage", "xml")
@nox.session(python=["3.7", "3.8", "3.9", "3.10", "3.11", "pypy"])

Remove codecov in favor of GHA artifacts to upload and combine coverage reports

See: https://hynek.me/til/ditch-codecov-python

Thanks to Ned for helping with the PR.