diff --git a/tests/integration/api_exec_test.py b/tests/integration/api_exec_test.py index 5b829e287..15080907c 100644 --- a/tests/integration/api_exec_test.py +++ b/tests/integration/api_exec_test.py @@ -286,13 +286,9 @@ def test_exec_command_tty_stream_no_demux(self): # tty=True, stream=True, demux=False res = self.client.exec_create(self.container, self.cmd, tty=True) exec_log = list(self.client.exec_start(res, stream=True)) - assert b'hello out\r\n' in exec_log - if len(exec_log) == 2: - assert b'hello err\r\n' in exec_log - else: - assert len(exec_log) == 3 - assert b'hello err' in exec_log - assert b'\r\n' in exec_log + merged = b''.join(chunk for chunk in exec_log) + assert b'hello out\r\n' in merged + assert b'hello err\r\n' in merged def test_exec_command_tty_no_stream_demux(self): # tty=True, stream=False, demux=True @@ -304,10 +300,6 @@ def test_exec_command_tty_stream_demux(self): # tty=True, stream=True, demux=True res = self.client.exec_create(self.container, self.cmd, tty=True) exec_log = list(self.client.exec_start(res, demux=True, stream=True)) - assert (b'hello out\r\n', None) in exec_log - if len(exec_log) == 2: - assert (b'hello err\r\n', None) in exec_log - else: - assert len(exec_log) == 3 - assert (b'hello err', None) in exec_log - assert (b'\r\n', None) in exec_log + merged = b''.join(chunk for chunk, _ in exec_log) + assert b'hello out\r\n' in merged + assert b'hello err\r\n' in merged