From 4dacf4914d392a8c1b07d7b23e94bf9ca094d5be Mon Sep 17 00:00:00 2001 From: Maciej Urbanski Date: Wed, 27 Mar 2024 21:44:06 +0100 Subject: [PATCH] make test under CI more verbose --- changelog.d/+verbose_ci.infrastructure.md | 1 + noxfile.py | 13 +++++++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) create mode 100644 changelog.d/+verbose_ci.infrastructure.md diff --git a/changelog.d/+verbose_ci.infrastructure.md b/changelog.d/+verbose_ci.infrastructure.md new file mode 100644 index 000000000..b80609a62 --- /dev/null +++ b/changelog.d/+verbose_ci.infrastructure.md @@ -0,0 +1 @@ +Increase verbosity when running tests under CI. diff --git a/noxfile.py b/noxfile.py index 34d328ea2..35b959b9c 100644 --- a/noxfile.py +++ b/noxfile.py @@ -74,6 +74,10 @@ def _detect_python_nox_id() -> str: 'test', ] +PYTEST_GLOBAL_ARGS = [] +if CI: + PYTEST_GLOBAL_ARGS.append("-vv") + def pdm_install( session: nox.Session, *groups: str, dev: bool = True, editable: bool = False @@ -159,7 +163,7 @@ def lint(session): # *PY_PATHS, # ) - session.run('pytest', 'test/static') + session.run('pytest', 'test/static', *PYTEST_GLOBAL_ARGS) session.run('liccheck', '-s', 'pyproject.toml') session.run('pdm', 'lock', '--check', external=True) @@ -177,6 +181,7 @@ def unit(session): '--cov-branch', '--cov-report=xml', '--doctest-modules', + *PYTEST_GLOBAL_ARGS, *session.posargs, 'test/unit', ] @@ -205,6 +210,7 @@ def run_integration_test(session, pytest_posargs): 'INFO', '-W', 'ignore::DeprecationWarning:rst2ansi.visitor:', + *PYTEST_GLOBAL_ARGS, *pytest_posargs, ] @@ -248,7 +254,10 @@ def test(session): def cleanup_buckets(session): """Remove buckets from previous test runs.""" pdm_install(session, 'test') - session.run('pytest', '-s', '-x', *session.posargs, 'test/integration/cleanup_buckets.py') + session.run( + 'pytest', '-s', '-x', *PYTEST_GLOBAL_ARGS, *session.posargs, + 'test/integration/cleanup_buckets.py' + ) @nox.session