coverage: Include code that runs in subprocesses
This commit is contained in:
parent
da01ee0a4b
commit
8550c29180
|
@ -137,22 +137,13 @@ jobs:
|
||||||
|
|
||||||
- name: Test with coverage
|
- name: Test with coverage
|
||||||
if: "matrix.use_coverage"
|
if: "matrix.use_coverage"
|
||||||
env:
|
run: "tox -e ${{ matrix.tox_env }}-coverage"
|
||||||
_PYTEST_TOX_COVERAGE_RUN: "coverage run -m"
|
|
||||||
COVERAGE_PROCESS_START: ".coveragerc"
|
|
||||||
_PYTEST_TOX_EXTRA_DEP: "coverage-enable-subprocess"
|
|
||||||
run: "tox -e ${{ matrix.tox_env }}"
|
|
||||||
|
|
||||||
- name: Prepare coverage token
|
- name: Upload coverage
|
||||||
if: (matrix.use_coverage && ( github.repository == 'pytest-dev/pytest' || github.event_name == 'pull_request' ))
|
if: matrix.use_coverage && github.repository == 'pytest-dev/pytest'
|
||||||
run: |
|
|
||||||
python scripts/append_codecov_token.py
|
|
||||||
|
|
||||||
- name: Report coverage
|
|
||||||
if: (matrix.use_coverage)
|
|
||||||
env:
|
env:
|
||||||
CODECOV_NAME: ${{ matrix.name }}
|
CODECOV_NAME: ${{ matrix.name }}
|
||||||
run: bash scripts/report-coverage.sh -F GHA,${{ runner.os }}
|
run: bash scripts/upload-coverage.sh -F GHA,${{ runner.os }}
|
||||||
|
|
||||||
linting:
|
linting:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
|
@ -1,36 +0,0 @@
|
||||||
"""
|
|
||||||
Appends the codecov token to the 'codecov.yml' file at the root of the repository.
|
|
||||||
|
|
||||||
This is done by CI during PRs and builds on the pytest-dev repository so we can
|
|
||||||
upload coverage, at least until codecov grows some native integration with GitHub Actions.
|
|
||||||
|
|
||||||
See discussion in https://github.com/pytest-dev/pytest/pull/6441 for more information.
|
|
||||||
"""
|
|
||||||
import os.path
|
|
||||||
from textwrap import dedent
|
|
||||||
|
|
||||||
|
|
||||||
def main():
|
|
||||||
this_dir = os.path.dirname(__file__)
|
|
||||||
cov_file = os.path.join(this_dir, "..", "codecov.yml")
|
|
||||||
|
|
||||||
assert os.path.isfile(cov_file), "{cov_file} does not exist".format(
|
|
||||||
cov_file=cov_file
|
|
||||||
)
|
|
||||||
|
|
||||||
with open(cov_file, "a") as f:
|
|
||||||
# token from: https://codecov.io/gh/pytest-dev/pytest/settings
|
|
||||||
# use same URL to regenerate it if needed
|
|
||||||
text = dedent(
|
|
||||||
"""
|
|
||||||
codecov:
|
|
||||||
token: "1eca3b1f-31a2-4fb8-a8c3-138b441b50a7"
|
|
||||||
"""
|
|
||||||
)
|
|
||||||
f.write(text)
|
|
||||||
|
|
||||||
print("Token updated:", cov_file)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
main()
|
|
|
@ -10,9 +10,7 @@ else
|
||||||
PATH="$PWD/.tox/${TOXENV##*,}/bin:$PATH"
|
PATH="$PWD/.tox/${TOXENV##*,}/bin:$PATH"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
python -m coverage combine
|
|
||||||
python -m coverage xml
|
python -m coverage xml
|
||||||
python -m coverage report -m
|
|
||||||
# Set --connect-timeout to work around https://github.com/curl/curl/issues/4461
|
# Set --connect-timeout to work around https://github.com/curl/curl/issues/4461
|
||||||
curl -S -L --connect-timeout 5 --retry 6 -s https://codecov.io/bash -o codecov-upload.sh
|
curl -S -L --connect-timeout 5 --retry 6 -s https://codecov.io/bash -o codecov-upload.sh
|
||||||
bash codecov-upload.sh -Z -X fix -f coverage.xml "$@"
|
bash codecov-upload.sh -Z -X fix -f coverage.xml "$@"
|
Loading…
Reference in New Issue