https://github.com/python/cpython/commit/763b6edb0ec959bdfb78f098b76829365de36ca5
commit: 763b6edb0ec959bdfb78f098b76829365de36ca5
branch: main
author: Malcolm Smith <[email protected]>
committer: freakboy3742 <[email protected]>
date: 2026-10-01T06:48:34+08:00
summary:

gh-158536: Skip some Android logging tests on OS versions with aggressive 
"chatty" filtering (#158531)

Address a test suite failure when run on Android 26-30 (inclusive) due to the
adb logger dropping lines with a "chatty ... Identical 3 lines" marker.

files:
M Lib/test/test_android.py

diff --git a/Lib/test/test_android.py b/Lib/test/test_android.py
index 201d701aff11eb..45c2911afa8bba 100644
--- a/Lib/test/test_android.py
+++ b/Lib/test/test_android.py
@@ -1,4 +1,5 @@
 import io
+import platform
 import queue
 import re
 import subprocess
@@ -16,6 +17,11 @@
 if sys.platform != "android":
     raise unittest.SkipTest("Android-specific")
 
+# Some API levels filter out consecutive identical lines and replace them with 
a
+# "chatty" marker.
+api_level = platform.android_ver().api_level
+chatty_issue = (26 <= api_level <= 30)
+
 # (name, level, fileno)
 STREAM_INFO = [("stdout", "I", 1), ("stderr", "W", 2)]
 
@@ -179,15 +185,13 @@ def write(s, lines=None, *, write_len=None):
                     write("\u0000b", [r"\xc0\x80b"])
                     write("a\u0000b", [r"a\xc0\x80b"])
 
-                # Multi-line messages. Avoid identical consecutive lines, as
-                # they may activate "chatty" filtering and break the tests.
-                #
-                # Additional spaces will appear in the output where necessary 
to
-                # protect leading newlines.
+                # Multi-line messages. Additional spaces will appear in the 
output where
+                # necessary to protect leading newlines.
                 write("\nx", [" "])
                 write("\na\n", ["x", "a"])
                 write("\n", [" "])
-                write("\n\n", [" ", " "])
+                if not chatty_issue:
+                    write("\n\n", [" ", " "])
                 write("b\n", ["b"])
                 write("c\n\n", ["c", " "])
                 write("d\ne", ["d"])
@@ -206,7 +210,8 @@ def write(s, lines=None, *, write_len=None):
                     write("\nx", [" ", "x"])
                     write("\na\n", [" ", "a"])
                     write("\n", [" "])
-                    write("\n\n", [" ", " "])
+                    if not chatty_issue:
+                        write("\n\n", [" ", " "])
                     write("b\n", ["b"])
                     write("c\n\n", ["c", " "])
                     write("d\ne", ["d", "e"])

_______________________________________________
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]

Reply via email to