summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJordan Cook <jordan.cook@pioneer.com>2022-04-15 18:11:22 -0500
committerJordan Cook <jordan.cook@pioneer.com>2022-04-15 18:32:31 -0500
commitaf1444e94f69986bb5c82768c4bffcfe666573b6 (patch)
tree8dc3506fd63d3a080de39812c691a6eb993678db
parent08248be2b1502a2adda0ecfdd1d86bd981dc256e (diff)
downloadrequests-cache-af1444e94f69986bb5c82768c4bffcfe666573b6.tar.gz
Generate XML coverage report for Codecov
-rw-r--r--.github/workflows/build.yml2
-rw-r--r--noxfile.py10
2 files changed, 7 insertions, 5 deletions
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index f29d7da..adea761 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -59,7 +59,7 @@ jobs:
- name: Run tests
run: |
source $VENV
- nox -e cov
+ nox -e cov -- xml
# Latest python version: send coverage report to codecov
- name: "Upload coverage report to Codecov"
diff --git a/noxfile.py b/noxfile.py
index 750bfb6..68348c5 100644
--- a/noxfile.py
+++ b/noxfile.py
@@ -25,8 +25,7 @@ PYTHON_VERSIONS = ['3.7', '3.8', '3.9', '3.10']
UNIT_TESTS = join('tests', 'unit')
INTEGRATION_TESTS = join('tests', 'integration')
STRESS_TEST_MULTIPLIER = 10
-# Generate HTML + stdout coverage report
-COVERAGE_ARGS = '--cov --cov-report=term --cov-report=html'
+DEFAULT_COVERAGE_FORMATS = ['html', 'term']
# Run tests in parallel, grouped by test module
XDIST_ARGS = '--numprocesses=auto --dist=loadfile'
@@ -58,8 +57,11 @@ def clean(session):
@session(python=False, name='cov')
def coverage(session):
"""Run tests and generate coverage report"""
- cmd = f'pytest {UNIT_TESTS} {INTEGRATION_TESTS} -rs {XDIST_ARGS} {COVERAGE_ARGS}'
- session.run(*cmd.split(' '))
+ cov_formats = session.posargs or DEFAULT_COVERAGE_FORMATS
+ cov_format_args = [f'--cov-report={f}' for f in cov_formats]
+
+ cmd = f'pytest {UNIT_TESTS} {INTEGRATION_TESTS} -rs {XDIST_ARGS} --cov'
+ session.run(*cmd.split(' '), *cov_format_args)
@session(python=False, name='stress')