From 6cffb9ae2d8d06f61828a6eb372091f8bc111ce1 Mon Sep 17 00:00:00 2001 From: Melissa DeLucchi Date: Fri, 25 Sep 2026 14:42:49 -0400 Subject: [PATCH] Give more helpful messages during CI failures. --- .github/workflows/smoke-test.yml | 2 +- .github/workflows/testing-and-coverage.yml | 2 +- pyproject.toml | 3 +++ python-project-template/.github/workflows/smoke-test.yml.jinja | 2 +- .../.github/workflows/testing-and-coverage.yml.jinja | 2 +- python-project-template/pyproject.toml.jinja | 1 + 6 files changed, 8 insertions(+), 4 deletions(-) diff --git a/.github/workflows/smoke-test.yml b/.github/workflows/smoke-test.yml index 43e5b49..c9ee305 100644 --- a/.github/workflows/smoke-test.yml +++ b/.github/workflows/smoke-test.yml @@ -41,7 +41,7 @@ jobs: - name: Run unit tests with pytest / pytest-copie run: | git config --global init.defaultBranch main - python -m pytest tests --python_version ${{ matrix.python-version }} + python -m pytest tests -o log_cli=true -vv --python_version ${{ matrix.python-version }} - name: Send status to Slack app if: ${{ failure() && github.event_name != 'workflow_dispatch' }} id: slack diff --git a/.github/workflows/testing-and-coverage.yml b/.github/workflows/testing-and-coverage.yml index dcf1ae8..cbcc57b 100644 --- a/.github/workflows/testing-and-coverage.yml +++ b/.github/workflows/testing-and-coverage.yml @@ -36,4 +36,4 @@ jobs: - name: Run unit tests with pytest / pytest-copie run: | git config --global init.defaultBranch main - python -m pytest tests --python_version ${{ matrix.python-version }} \ No newline at end of file + python -m pytest tests -o log_cli=true -vv --python_version ${{ matrix.python-version }} \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index d4aab3f..a30848a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -67,3 +67,6 @@ line-length = 110 [tool.isort] profile = "black" line_length = 110 + +[tool.pytest.ini_options] +log_cli_level = "INFO" \ No newline at end of file diff --git a/python-project-template/.github/workflows/smoke-test.yml.jinja b/python-project-template/.github/workflows/smoke-test.yml.jinja index 2f7f17d..209785b 100644 --- a/python-project-template/.github/workflows/smoke-test.yml.jinja +++ b/python-project-template/.github/workflows/smoke-test.yml.jinja @@ -40,7 +40,7 @@ jobs: pip list - name: Run unit tests with pytest run: | - python -m pytest + python -m pytest -o log_cli=true -vv {%- if 'email' in failure_notification %} - name: Send status to author's email if: {% raw %}${{ failure() }} && github.event_name != 'workflow_dispatch' }}{% endraw %} # Only email if the workflow failed and was not manually started. Customize this as necessary. diff --git a/python-project-template/.github/workflows/testing-and-coverage.yml.jinja b/python-project-template/.github/workflows/testing-and-coverage.yml.jinja index fa62317..53d6e82 100644 --- a/python-project-template/.github/workflows/testing-and-coverage.yml.jinja +++ b/python-project-template/.github/workflows/testing-and-coverage.yml.jinja @@ -33,7 +33,7 @@ jobs: if [ -f requirements.txt ]; then uv pip install --system -r requirements.txt; fi - name: Run unit tests with pytest run: | - python -m pytest --cov={{package_name}} --cov-report=xml + python -m pytest -o log_cli=true -vv --cov={{package_name}} --cov-report=xml - name: Upload coverage report to codecov uses: codecov/codecov-action@v7 with: diff --git a/python-project-template/pyproject.toml.jinja b/python-project-template/pyproject.toml.jinja index 24998d6..43324fa 100644 --- a/python-project-template/pyproject.toml.jinja +++ b/python-project-template/pyproject.toml.jinja @@ -74,6 +74,7 @@ testpaths = [ "docs", ] addopts = "--doctest-modules --doctest-glob=*.rst" +log_cli_level = "INFO" {% if 'black' in enforce_style -%} [tool.black]