From 323c7d4ae29adf24c590745b96880938e6641e9f Mon Sep 17 00:00:00 2001 From: Benjamin Bannier Date: Mon, 22 Jun 2026 14:06:25 +0200 Subject: [PATCH 1/2] Prevent progress printing `100%` if not fully done Previously we could print a test progress of `100%` even though there were still tests running due to how we might round up, and for projects with huge BTest suite this was pretty likely. With this patch we make sure we _always_ round down to the nearest integer so we don't report "all done" before we are actually done. --- btest | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/btest b/btest index bfa09ab..7e5d878 100755 --- a/btest +++ b/btest @@ -1832,7 +1832,7 @@ class Console(OutputHandler): OutputHandler.__init__(self, options, reopen_std_file(sys.__stdout__)) def testStart(self, test): - msg = f"[{test.mgr.percentage():>3.0f}%] {test.displayName()} ..." + msg = f"[{int(test.mgr.percentage()):>3d}%] {test.displayName()} ..." self.output(test, msg, nl=False) def testProgress(self, test, msg): @@ -1931,7 +1931,7 @@ class CompactConsole(Console): self._outfile.flush() def _consoleOutput(self, test, msg, sticky): - line = f"[{test.mgr.percentage():>3.0f}%] {test.displayName()} ..." + line = f"[{int(test.mgr.percentage()):>3d}%] {test.displayName()} ..." if msg: line += " " + msg From f5a509ca16084612b1546ddc3e51162ff05e6930 Mon Sep 17 00:00:00 2001 From: Benjamin Bannier Date: Mon, 22 Jun 2026 14:25:10 +0200 Subject: [PATCH 2/2] Bump and freeze pre-commit hooks This required a small cleanup to `btest-diff` where shellcheck was unable to detect that a function was only used in a trap call; we replaced this with simpler code which does not trigger any warnings. --- .pre-commit-config.yaml | 8 ++++---- btest-diff | 7 +------ sphinx/btest-sphinx.py | 1 - 3 files changed, 5 insertions(+), 11 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 351d222..403cf2e 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -2,20 +2,20 @@ # See https://pre-commit.com/hooks.html for more hooks repos: - repo: https://github.com/shellcheck-py/shellcheck-py - rev: v0.10.0.1 + rev: 745eface02aef23e168a8afb6b5737818efbea95 # frozen: v0.11.0.1 hooks: - id: shellcheck exclude: examples/|testing/tests/.*\.sh - repo: https://github.com/maxwinterstein/shfmt-py - rev: v3.11.0.2 + rev: 85cc16bc0319e182d7b62b0a2de351358083ce4c # frozen: v4.0.0 hooks: - id: shfmt exclude: examples/t6.sh args: ["-w", "-i", "4", "-ci"] - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v5.0.0 + rev: 3e8a8703264a2f4a69428a0aa4dcb512790b2c8c # frozen: v6.0.0 hooks: - id: trailing-whitespace exclude: ^testing/Baseline @@ -23,7 +23,7 @@ repos: exclude: ^testing/Baseline|examples/.*Baseline.* - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.11.6 + rev: 77039ccbba72c8aede339c5f8ae29b42aced0a2e # frozen: v0.15.18 hooks: - id: ruff args: [--fix] diff --git a/btest-diff b/btest-diff index bf0178c..706a81d 100755 --- a/btest-diff +++ b/btest-diff @@ -148,12 +148,7 @@ if [ ! -f "$input" ]; then fi tmpfiles="" -delete_tmps() { - # shellcheck disable=SC2086,SC2317 - rm -f $tmpfiles 2>/dev/null -} - -trap delete_tmps 0 +trap 'rm -f $tmpfiles 2>/dev/null' 0 # First available baseline across directories. baseline="" diff --git a/sphinx/btest-sphinx.py b/sphinx/btest-sphinx.py index 8a4d5a1..5b3f03c 100644 --- a/sphinx/btest-sphinx.py +++ b/sphinx/btest-sphinx.py @@ -6,7 +6,6 @@ from docutils import nodes, utils from docutils.parsers.rst import Directive, Parser, directives from docutils.transforms import Transform - from sphinx.directives.code import LiteralInclude from sphinx.errors import SphinxError from sphinx.util import logging