From 23f8023e74b594e02a5517481ca722dcb20d43b5 Mon Sep 17 00:00:00 2001 From: Evgeniy Zayats Date: Thu, 25 Apr 2024 20:28:30 -0400 Subject: [PATCH] tests: handle pexpect on macos Signed-off-by: Evgeniy Zayats --- pytest_tests/lib/s3/s3_gate_base.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/pytest_tests/lib/s3/s3_gate_base.py b/pytest_tests/lib/s3/s3_gate_base.py index 9bd68cb7e..eba8aedb0 100644 --- a/pytest_tests/lib/s3/s3_gate_base.py +++ b/pytest_tests/lib/s3/s3_gate_base.py @@ -2,6 +2,7 @@ import logging import os import re +import sys import uuid from typing import Any, Optional @@ -39,8 +40,12 @@ def _run_with_passwd(cmd: str, password: str) -> str: child.delaybeforesend = 1 child.expect(".*") child.sendline(f"{password}\r") - child.wait() - cmd = child.read() + if sys.platform == "darwin": + child.expect(pexpect.EOF) + cmd = child.before + else: + child.wait() + cmd = child.read() return cmd.decode()