Skip to content

Commit 267cfd3

Browse files
authored
CNDB-11460 another fix for cqlsh unicode tests in TestCqlshUnicode (#1618)
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.
1 parent 59faf8a commit 267cfd3

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

pylib/cqlshlib/test/run_cqlsh.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,7 @@ def read_until(self, until, blksize=4096, timeout=None,
249249
cqlshlog.debug("Searching for %r" % (until.pattern,))
250250
got = self.readbuf
251251
self.readbuf = ''
252+
empty_reads = 0
252253
with timing_out(timeout):
253254
while True:
254255
val = self.read(blksize, ptty_timeout)
@@ -257,7 +258,13 @@ def read_until(self, until, blksize=4096, timeout=None,
257258
val = val.replace(replace_target, '')
258259
cqlshlog.debug("read %r from subproc" % (val,))
259260
if val == '':
260-
raise EOFError("'until' pattern %r not found" % (until.pattern,))
261+
empty_reads += 1
262+
if empty_reads > 1:
263+
raise EOFError("'until' pattern %r not found" % (until.pattern,))
264+
# Read again to allow decoding of UTF-8 characters that span multiple reads
265+
continue
266+
267+
empty_reads = 0
261268
got += val
262269
m = until.search(got)
263270
if m is not None:

0 commit comments

Comments
 (0)