Skip to content

Commit a939b12

Browse files
committed
Merge remote-tracking branch 'origin/topic/bbannier/upgrade-string-formatting'
* origin/topic/bbannier/upgrade-string-formatting: Bump used GH actions Add python-3.13 to CI Bump pre-commit hooks Prefer format or f-strings over percent formatting
2 parents 11ed25a + 51d5cd8 commit a939b12

File tree

7 files changed

+49
-29
lines changed

7 files changed

+49
-29
lines changed

.github/workflows/btest.yml

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,12 @@ jobs:
1212
Run-BTest:
1313
strategy:
1414
matrix:
15-
python-version: ["3.9", "3.10", "3.11", "3.12"]
15+
python-version:
16+
- "3.9"
17+
- "3.10"
18+
- "3.11"
19+
- "3.12"
20+
- "3.13"
1621
os: [macos-latest, ubuntu-latest, windows-latest]
1722

1823
runs-on: ${{ matrix.os }}
@@ -24,9 +29,9 @@ jobs:
2429
run: |
2530
git config --global core.autocrlf false
2631
git config --global core.eol lf
27-
- uses: actions/checkout@v3
32+
- uses: actions/checkout@v4
2833
- name: Set up Python ${{ matrix.python-version }}
29-
uses: actions/setup-python@v4
34+
uses: actions/setup-python@v5
3035
with:
3136
python-version: ${{ matrix.python-version }}
3237
- name: Install dependencies (Windows)
@@ -53,16 +58,21 @@ jobs:
5358
Test-SetupPY:
5459
strategy:
5560
matrix:
56-
python-version: ["3.9", "3.10", "3.11", "3.12"]
61+
python-version:
62+
- "3.9"
63+
- "3.10"
64+
- "3.11"
65+
- "3.12"
66+
- "3.13"
5767
os: [ubuntu-latest]
5868

5969
runs-on: ${{ matrix.os }}
6070
steps:
6171
- name: Set up Python ${{ matrix.python-version }}
62-
uses: actions/setup-python@v4
72+
uses: actions/setup-python@v5
6373
with:
6474
python-version: ${{ matrix.python-version }}
65-
- uses: actions/checkout@v3
75+
- uses: actions/checkout@v4
6676
- name: "Install pip and the btest package"
6777
run: |
6878
python3 -m pip install --upgrade pip
@@ -82,7 +92,7 @@ jobs:
8292
needs: [Run-BTest, Test-SetupPY]
8393
if: github.repository == 'zeek/btest' && github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
8494
steps:
85-
- uses: actions/checkout@v3
95+
- uses: actions/checkout@v4
8696
- name: Check release version
8797
# This fails e.g. if VERSION contains a dev commits suffix,
8898
# since we don't want to push these to PyPI. Accepts two-

.pre-commit-config.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,15 @@ repos:
1515
args: ["-w", "-i", "4", "-ci"]
1616

1717
- repo: https://github.com/pre-commit/pre-commit-hooks
18-
rev: v4.6.0
18+
rev: v5.0.0
1919
hooks:
2020
- id: trailing-whitespace
2121
exclude: ^testing/Baseline
2222
- id: end-of-file-fixer
2323
exclude: ^testing/Baseline|examples/.*Baseline.*
2424

2525
- repo: https://github.com/astral-sh/ruff-pre-commit
26-
rev: v0.5.5
26+
rev: v0.8.1
2727
hooks:
2828
- id: ruff
2929
args: [--fix]

CHANGES

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
1.1-28 | 2024-12-05 12:37:47 -0700
2+
3+
* Bump used GH actions (Benjamin Bannier, Corelight)
4+
5+
* Add python-3.13 to CI (Benjamin Bannier, Corelight)
6+
7+
* Bump pre-commit hooks (Benjamin Bannier, Corelight)
8+
9+
* Prefer format or f-strings over percent formatting (Benjamin Bannier, Corelight)
10+
111
1.1-23 | 2024-12-04 19:18:04 +0100
212

313
* btest-setsid: Fail on setsid() error (Arne Welzel, Corelight)

README

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
..
33
.. Version number is filled in automatically.
44

5-
.. |version| replace:: 1.1-23
5+
.. |version| replace:: 1.1-28
66

77
==================================================
88
BTest - A Generic Driver for Powerful System Tests

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.1-23
1+
1.1-28

btest

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ else:
5656
import multiprocessing.managers as mp_managers
5757
import multiprocessing.sharedctypes as mp_sharedctypes
5858

59-
VERSION = "1.1-23" # Automatically filled in.
59+
VERSION = "1.1-28" # Automatically filled in.
6060

6161
Name = "btest"
6262
Config = None
@@ -493,7 +493,7 @@ class TestManager(mp_managers.SyncManager):
493493
# zeek processes, but runner processes executing individual test commands.
494494
for i in range(Options.threads):
495495
t = mp.Process(
496-
name="#%d" % (i + 1), target=lambda: self.threadRun(i, mgr_data)
496+
name=f"#{i+1}", target=lambda: self.threadRun(i, mgr_data)
497497
)
498498
t.start()
499499
threads += [t]
@@ -829,7 +829,7 @@ class TestManager(mp_managers.SyncManager):
829829
out = open(path, "w")
830830

831831
for k, v in timing.items():
832-
print("%s %u" % (k, v), file=out)
832+
print(f"{k} {v}", file=out)
833833

834834
out.close()
835835

@@ -1068,7 +1068,7 @@ class Test:
10681068

10691069
if increment:
10701070
clone.number = self.number + 1
1071-
clone.name = "%s-%d" % (self.basename, clone.number)
1071+
clone.name = f"{self.basename}-{clone.number}"
10721072
elif self.name:
10731073
clone.name = self.name
10741074

@@ -1607,8 +1607,8 @@ class OutputHandler:
16071607
# TestManager.run() defines the process names to "#<n>". Align the
16081608
# prefixes by using enough space for the number of threads
16091609
# requested, plus 1 for "#".
1610-
pat = "[%%+%ds]" % (len(str(self.options().threads)) + 1)
1611-
return pat % mp.current_process().name
1610+
width = len(str(self.options().threads)) + 1
1611+
return f"[%+{mp.current_process().name:>{width}}]"
16121612
else:
16131613
return ""
16141614

@@ -1813,7 +1813,7 @@ class Console(OutputHandler):
18131813
OutputHandler.__init__(self, options, reopen_std_file(sys.__stdout__))
18141814

18151815
def testStart(self, test):
1816-
msg = "[%3d%%] %s ..." % (test.mgr.percentage(), test.displayName())
1816+
msg = f"[{test.mgr.percentage():>3}%] {test.displayName()} ..."
18171817
self.output(test, msg, nl=False)
18181818

18191819
def testProgress(self, test, msg):
@@ -1912,7 +1912,7 @@ class CompactConsole(Console):
19121912
self._outfile.flush()
19131913

19141914
def _consoleOutput(self, test, msg, sticky):
1915-
line = "[%3d%%] %s ..." % (test.mgr.percentage(), test.displayName())
1915+
line = f"[{test.mgr.percentage():>3.0f}%] {test.displayName()} ..."
19161916

19171917
if msg:
19181918
line += " " + msg
@@ -1976,7 +1976,7 @@ class Verbose(OutputHandler):
19761976
part = ""
19771977

19781978
if cmdline.part > 1:
1979-
part = " [part #%d]" % cmdline.part
1979+
part = f" [part #{cmdline.part}]"
19801980

19811981
self.output(test, self.threadPrefix(), nl=False)
19821982
self.output(test, f" > {cmdline.cmdline}{part}")
@@ -3319,17 +3319,16 @@ if __name__ == "__main__":
33193319
mgr.shutdown()
33203320
sys.exit(1)
33213321

3322-
skip = (", %d skipped" % skipped) if skipped > 0 else ""
3323-
unstablestr = (", %d unstable" % unstable) if unstable > 0 else ""
3322+
skip = f", {skipped} skipped" if skipped > 0 else ""
3323+
unstablestr = f", {unstable} unstable" if unstable > 0 else ""
33243324
failed_expectedstr = (
3325-
(" (with %d expected to fail)" % failed_expected) if failed_expected > 0 else ""
3325+
f" (with {failed_expected} expected to fail)" if failed_expected > 0 else ""
33263326
)
33273327

33283328
if failed > 0:
33293329
if not Options.quiet:
33303330
output(
3331-
"%d of %d test%s failed%s%s%s"
3332-
% (
3331+
"{} of {} test{} failed{}{}{}".format(
33333332
failed,
33343333
total,
33353334
"s" if total > 1 else "",
@@ -3347,14 +3346,15 @@ if __name__ == "__main__":
33473346
elif skipped > 0 or unstable > 0:
33483347
if not Options.quiet:
33493348
output(
3350-
"%d test%s successful%s%s"
3351-
% (succeeded, "s" if succeeded != 1 else "", skip, unstablestr)
3349+
"{} test{} successful{}{}".format(
3350+
succeeded, "s" if succeeded != 1 else "", skip, unstablestr
3351+
)
33523352
)
33533353

33543354
sys.exit(0)
33553355

33563356
else:
33573357
if not Options.quiet:
3358-
output("all %d tests successful" % total)
3358+
output(f"all {total} tests successful")
33593359

33603360
sys.exit(0)

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@
55
py_modules = ["btest-sphinx"]
66

77
setup(
8-
version="1.1.dev23", # Filled in automatically.
8+
version="1.1.dev28", # Filled in automatically.
99
py_modules=py_modules,
1010
)

0 commit comments

Comments
 (0)