From 4123dc25667abaa4d9a8897c14dfe2d9a1a0f3f0 Mon Sep 17 00:00:00 2001 From: Daniel Jatnieks Date: Mon, 3 Mar 2025 15:19:46 -0800 Subject: [PATCH] CNDB-11460 another fix for cqlsh unicode tests in TestCqlshUnicode - make a second read in read_until to get UTF-8 characters that are split across reads. --- pylib/cqlshlib/test/run_cqlsh.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/pylib/cqlshlib/test/run_cqlsh.py b/pylib/cqlshlib/test/run_cqlsh.py index a335735b09c4..f592cc078f28 100644 --- a/pylib/cqlshlib/test/run_cqlsh.py +++ b/pylib/cqlshlib/test/run_cqlsh.py @@ -249,6 +249,7 @@ def read_until(self, until, blksize=4096, timeout=None, cqlshlog.debug("Searching for %r" % (until.pattern,)) got = self.readbuf self.readbuf = '' + empty_reads = 0 with timing_out(timeout): while True: val = self.read(blksize, ptty_timeout) @@ -257,7 +258,13 @@ def read_until(self, until, blksize=4096, timeout=None, val = val.replace(replace_target, '') cqlshlog.debug("read %r from subproc" % (val,)) if val == '': - raise EOFError("'until' pattern %r not found" % (until.pattern,)) + empty_reads += 1 + if empty_reads > 1: + raise EOFError("'until' pattern %r not found" % (until.pattern,)) + # Read again to allow decoding of UTF-8 characters that span multiple reads + continue + + empty_reads = 0 got += val m = until.search(got) if m is not None: