Skip to content

Commit 8af85d2

Browse files
committed
Include relative path to test in output log, use textwrap for args
With the new free-form 'name:' it can be difficult for a test developer reading the log output to immediately make out which test (file) they are looking at. This commit adds the relative path to the test to the log and formats any arguments using the textwrap package. Example: Starting: path/to/test suite-supplied mode:long scratch:/tmp/9pm_i78hxc2f base:/home/jocke/src/infix/test/9pm/unit_tests/harness optional-positive:yes skip-positive:yes cmdl-supplied 2025-09-14 07:03:39 1..6 ... Signed-off-by: Joachim Wiberg <[email protected]>
1 parent 32e813c commit 8af85d2

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

9pm.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
import re
1212
import atexit
1313
import hashlib
14+
import textwrap
1415
from datetime import datetime
1516

1617
TEST_CNT=0
@@ -65,8 +66,17 @@ def execute(args, test, output_log):
6566
test_skip = False
6667
err = False
6768

69+
cmd = path = os.path.relpath(test['case'], ROOT_PATH)
6870
if args:
69-
output_log.write(f"Starting with arguments: {args}\n\n")
71+
cmd = f"{path} {' '.join(args)}"
72+
73+
prefix = "Starting: "
74+
wrapped = textwrap.fill(f"{prefix}{cmd}", width=100,
75+
subsequent_indent=" " * (len(prefix) +
76+
len(path) + 1),
77+
break_long_words=False,
78+
break_on_hyphens=False)
79+
output_log.write(f"{wrapped}\n\n")
7080

7181
while True:
7282
line = proc.stdout.readline().decode('utf-8')

0 commit comments

Comments
 (0)