From 6707701f2d42fa664bd31b084a1dd5a9ab48276d Mon Sep 17 00:00:00 2001 From: skshetry <18718008+skshetry@users.noreply.github.com> Date: Thu, 12 Sep 2024 09:03:20 +0545 Subject: [PATCH] tests: fix mock for subprocess stdout/stderr to return BytesIO (#431) --- tests/func/test_catalog.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/func/test_catalog.py b/tests/func/test_catalog.py index 87f5eed7e..33c444bfb 100644 --- a/tests/func/test_catalog.py +++ b/tests/func/test_catalog.py @@ -46,7 +46,7 @@ def pre_created_ds_name(): @pytest.fixture def mock_popen(mocker): m = mocker.patch( - "subprocess.Popen", returncode=0, stdout=io.StringIO(), stderr=io.StringIO() + "subprocess.Popen", returncode=0, stdout=io.BytesIO(), stderr=io.BytesIO() ) m.return_value.__enter__.return_value = m # keep in sync with the returncode @@ -70,7 +70,7 @@ def mock_popen_dataset_created( [f"{cloud_test_catalog.src_uri}/dogs/*"], recursive=True, ) - mock_popen.configure_mock(stdout=io.StringIO("user log 1\nuser log 2")) + mock_popen.configure_mock(stdout=io.BytesIO(b"user log 1\nuser log 2")) yield mock_popen