diff options
author | Jordan Cook <jordan.cook@pioneer.com> | 2022-04-15 18:11:22 -0500 |
---|---|---|
committer | Jordan Cook <jordan.cook@pioneer.com> | 2022-04-15 18:32:31 -0500 |
commit | af1444e94f69986bb5c82768c4bffcfe666573b6 (patch) | |
tree | 8dc3506fd63d3a080de39812c691a6eb993678db /noxfile.py | |
parent | 08248be2b1502a2adda0ecfdd1d86bd981dc256e (diff) | |
download | requests-cache-af1444e94f69986bb5c82768c4bffcfe666573b6.tar.gz |
Generate XML coverage report for Codecov
Diffstat (limited to 'noxfile.py')
-rw-r--r-- | noxfile.py | 10 |
1 files changed, 6 insertions, 4 deletions
@@ -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') |