diff --git a/.github/workflows/btest.yml b/.github/workflows/btest.yml index 6cf75ab..0a0781c 100644 --- a/.github/workflows/btest.yml +++ b/.github/workflows/btest.yml @@ -12,7 +12,12 @@ jobs: Run-BTest: strategy: matrix: - python-version: ["3.9", "3.10", "3.11", "3.12"] + python-version: + - "3.9" + - "3.10" + - "3.11" + - "3.12" + - "3.13" os: [macos-latest, ubuntu-latest, windows-latest] runs-on: ${{ matrix.os }} @@ -24,9 +29,9 @@ jobs: run: | git config --global core.autocrlf false git config --global core.eol lf - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} - name: Install dependencies (Windows) @@ -53,16 +58,21 @@ jobs: Test-SetupPY: strategy: matrix: - python-version: ["3.9", "3.10", "3.11", "3.12"] + python-version: + - "3.9" + - "3.10" + - "3.11" + - "3.12" + - "3.13" os: [ubuntu-latest] runs-on: ${{ matrix.os }} steps: - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: "Install pip and the btest package" run: | python3 -m pip install --upgrade pip @@ -82,7 +92,7 @@ jobs: needs: [Run-BTest, Test-SetupPY] if: github.repository == 'zeek/btest' && github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Check release version # This fails e.g. if VERSION contains a dev commits suffix, # since we don't want to push these to PyPI. Accepts two- diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 17783a6..40497b5 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -15,7 +15,7 @@ repos: args: ["-w", "-i", "4", "-ci"] - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.6.0 + rev: v5.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.5.5 + rev: v0.8.1 hooks: - id: ruff args: [--fix] diff --git a/CHANGES b/CHANGES index d4ae518..19dae67 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,13 @@ +1.1-28 | 2024-12-05 12:37:47 -0700 + + * Bump used GH actions (Benjamin Bannier, Corelight) + + * Add python-3.13 to CI (Benjamin Bannier, Corelight) + + * Bump pre-commit hooks (Benjamin Bannier, Corelight) + + * Prefer format or f-strings over percent formatting (Benjamin Bannier, Corelight) + 1.1-23 | 2024-12-04 19:18:04 +0100 * btest-setsid: Fail on setsid() error (Arne Welzel, Corelight) diff --git a/README b/README index c87826d..1861b52 100644 --- a/README +++ b/README @@ -2,7 +2,7 @@ .. .. Version number is filled in automatically. -.. |version| replace:: 1.1-23 +.. |version| replace:: 1.1-28 ================================================== BTest - A Generic Driver for Powerful System Tests diff --git a/VERSION b/VERSION index b5d279e..c541490 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.1-23 +1.1-28 diff --git a/btest b/btest index dffb2b9..dcdc360 100755 --- a/btest +++ b/btest @@ -56,7 +56,7 @@ else: import multiprocessing.managers as mp_managers import multiprocessing.sharedctypes as mp_sharedctypes -VERSION = "1.1-23" # Automatically filled in. +VERSION = "1.1-28" # Automatically filled in. Name = "btest" Config = None @@ -493,7 +493,7 @@ class TestManager(mp_managers.SyncManager): # zeek processes, but runner processes executing individual test commands. for i in range(Options.threads): t = mp.Process( - name="#%d" % (i + 1), target=lambda: self.threadRun(i, mgr_data) + name=f"#{i+1}", target=lambda: self.threadRun(i, mgr_data) ) t.start() threads += [t] @@ -829,7 +829,7 @@ class TestManager(mp_managers.SyncManager): out = open(path, "w") for k, v in timing.items(): - print("%s %u" % (k, v), file=out) + print(f"{k} {v}", file=out) out.close() @@ -1068,7 +1068,7 @@ class Test: if increment: clone.number = self.number + 1 - clone.name = "%s-%d" % (self.basename, clone.number) + clone.name = f"{self.basename}-{clone.number}" elif self.name: clone.name = self.name @@ -1607,8 +1607,8 @@ class OutputHandler: # TestManager.run() defines the process names to "#". Align the # prefixes by using enough space for the number of threads # requested, plus 1 for "#". - pat = "[%%+%ds]" % (len(str(self.options().threads)) + 1) - return pat % mp.current_process().name + width = len(str(self.options().threads)) + 1 + return f"[%+{mp.current_process().name:>{width}}]" else: return "" @@ -1813,7 +1813,7 @@ class Console(OutputHandler): OutputHandler.__init__(self, options, reopen_std_file(sys.__stdout__)) def testStart(self, test): - msg = "[%3d%%] %s ..." % (test.mgr.percentage(), test.displayName()) + msg = f"[{test.mgr.percentage():>3}%] {test.displayName()} ..." self.output(test, msg, nl=False) def testProgress(self, test, msg): @@ -1912,7 +1912,7 @@ class CompactConsole(Console): self._outfile.flush() def _consoleOutput(self, test, msg, sticky): - line = "[%3d%%] %s ..." % (test.mgr.percentage(), test.displayName()) + line = f"[{test.mgr.percentage():>3.0f}%] {test.displayName()} ..." if msg: line += " " + msg @@ -1976,7 +1976,7 @@ class Verbose(OutputHandler): part = "" if cmdline.part > 1: - part = " [part #%d]" % cmdline.part + part = f" [part #{cmdline.part}]" self.output(test, self.threadPrefix(), nl=False) self.output(test, f" > {cmdline.cmdline}{part}") @@ -3319,17 +3319,16 @@ if __name__ == "__main__": mgr.shutdown() sys.exit(1) - skip = (", %d skipped" % skipped) if skipped > 0 else "" - unstablestr = (", %d unstable" % unstable) if unstable > 0 else "" + skip = f", {skipped} skipped" if skipped > 0 else "" + unstablestr = f", {unstable} unstable" if unstable > 0 else "" failed_expectedstr = ( - (" (with %d expected to fail)" % failed_expected) if failed_expected > 0 else "" + f" (with {failed_expected} expected to fail)" if failed_expected > 0 else "" ) if failed > 0: if not Options.quiet: output( - "%d of %d test%s failed%s%s%s" - % ( + "{} of {} test{} failed{}{}{}".format( failed, total, "s" if total > 1 else "", @@ -3347,14 +3346,15 @@ if __name__ == "__main__": elif skipped > 0 or unstable > 0: if not Options.quiet: output( - "%d test%s successful%s%s" - % (succeeded, "s" if succeeded != 1 else "", skip, unstablestr) + "{} test{} successful{}{}".format( + succeeded, "s" if succeeded != 1 else "", skip, unstablestr + ) ) sys.exit(0) else: if not Options.quiet: - output("all %d tests successful" % total) + output(f"all {total} tests successful") sys.exit(0) diff --git a/setup.py b/setup.py index 0e5841f..9b6c393 100644 --- a/setup.py +++ b/setup.py @@ -5,6 +5,6 @@ py_modules = ["btest-sphinx"] setup( - version="1.1.dev23", # Filled in automatically. + version="1.1.dev28", # Filled in automatically. py_modules=py_modules, )