Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 12 additions & 7 deletions Lib/test/test_android.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import io
import platform
import queue
import re
import subprocess
Expand All @@ -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)]

Expand Down Expand Up @@ -174,15 +180,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"])
Expand All @@ -201,7 +205,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"])
Expand Down
Loading