FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

[3.13] gh-129248: Filter out the iOS log prefix from testbed runner output. (GH-129252) by miss-islington · Pull Request #129283 · python/cpython · GitHub

/ cpython Public
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .py  (1) .rst  (1) All 2 file types selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
The iOS test runner now strips the log prefix from each line output by the
test suite.
15 changes: 15 additions & 0 deletions iOS/testbed/__main__.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import asyncio
import json
import plistlib
import re
import shutil
import subprocess
import sys
Expand All @@ -12,6 +13,18 @@

DECODE_ARGS = ("UTF-8", "backslashreplace")

# The system log prefixes each line:
# 2025-01-17 16:14:29.090 Df iOSTestbed[23987:1fd393b4] (Python) ...
# 2025-01-17 16:14:29.090 E iOSTestbed[23987:1fd393b4] (Python) ...

LOG_PREFIX_REGEX = re.compile(
r"^\d{4}-\d{2}-\d{2}" # YYYY-MM-DD
r"\s+\d+:\d{2}:\d{2}\.\d+" # HH:MM:SS.sss
r"\s+\w+" # Df/E
r"\s+iOSTestbed\[\d+:\w+\]" # Process/thread ID
r"\s+\(Python\)\s" # Logger name
)


# Work around a bug involving sys.exit and TaskGroups
# (https://github.com/python/cpython/issues/101515).
Expand Down Expand Up @@ -131,6 +144,8 @@ async def log_stream_task(initial_devices):
) as process:
suppress_dupes = False
while line := (await process.stdout.readline()).decode(*DECODE_ARGS):
# Strip the prefix from each log line
line = LOG_PREFIX_REGEX.sub("", line)
# The iOS log streamer can sometimes lag; when it does, it outputs
# a warning about messages being dropped... often multiple times.
# Only print the first of these duplicated warnings.
Expand Down

Back | FazBrowse Home | New Git URL