https://github.com/python/cpython/commit/638d638a5ad3a7b34d5d4597bbb61c1645bdeb6a
commit: 638d638a5ad3a7b34d5d4597bbb61c1645bdeb6a
branch: main
author: Zachary Ware <[email protected]>
committer: zware <[email protected]>
date: 2026-10-21T11:22:59-05:00
summary:
Keep memory report aligned in regrtest output (#159967)
files:
M Lib/test/libregrtest/logger.py
M Lib/test/test_regrtest.py
diff --git a/Lib/test/libregrtest/logger.py b/Lib/test/libregrtest/logger.py
index 4e011ef06f8a913..7c1d9e528010c3b 100644
--- a/Lib/test/libregrtest/logger.py
+++ b/Lib/test/libregrtest/logger.py
@@ -29,11 +29,12 @@ def log(self, line: str = '') -> None:
if self.get_mem_usage is not None:
mem = self.get_mem_usage()
if mem:
- mib = mem / (1024*1024)
- if mib >= 1024:
- line = f"mem: {mib / 1024:.1f} GiB {line}"
- else:
- line = f"mem: {mib:.1f} MiB {line}"
+ qty = mem / (1024*1024)
+ unit = 'MiB'
+ if qty >= 1024:
+ qty = qty / 1024
+ unit = 'GiB'
+ line = f"mem: {qty:6.1f} {unit} {line}"
# Add the system load prefix: "load avg: 1.80 "
load_avg = self.get_load_avg()
diff --git a/Lib/test/test_regrtest.py b/Lib/test/test_regrtest.py
index 53f0a2863dc4e45..dc9770fb4e5fbd3 100644
--- a/Lib/test/test_regrtest.py
+++ b/Lib/test/test_regrtest.py
@@ -48,7 +48,7 @@
LOG_PREFIX = (
r'[0-9]+:[0-9]+:[0-9]+ '
r'(?:load avg: [0-9]+\.[0-9]{2} )?'
- r'(?:mem: [0-9]+\.[0-9] (?:MiB|GiB) )?'
+ r'(?:mem: +[0-9]+\.[0-9] (?:MiB|GiB) )?'
)
RESULT_REGEX = (
'passed',
_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3//lists/python-checkins.python.org
Member address: [email protected]