From a0ac951a90b050a5d48158a9a33cabbc362f70db Mon Sep 17 00:00:00 2001 From: Jordan Cook Date: Tue, 19 Apr 2022 15:15:07 -0500 Subject: Run pytest --verbose in CI --- noxfile.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'noxfile.py') diff --git a/noxfile.py b/noxfile.py index 737e266..93f6cbc 100644 --- a/noxfile.py +++ b/noxfile.py @@ -7,6 +7,7 @@ Notes: * All other commands: the current environment will be used instead of creating new ones * Run `nox -l` to see all available commands """ +from os import getenv from os.path import join from shutil import rmtree @@ -57,11 +58,16 @@ 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} --cov'.split(' ') + + # Add coverage formats cov_formats = session.posargs or DEFAULT_COVERAGE_FORMATS - cov_format_args = [f'--cov-report={f}' for f in cov_formats] + cmd += [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) + # Add verbose flag, if set by environment + if getenv('PYTEST_VERBOSE'): + cmd += ['--verbose'] + session.run(*cmd) @session(python=False, name='stress') -- cgit v1.2.1