From 2f2aabeb5a2a0be3aa6912dba4fa8c4cdc3138f4 Mon Sep 17 00:00:00 2001 From: grossmj Date: Fri, 11 Aug 2023 17:58:00 +1000 Subject: [PATCH] Fix tests when running Python 3.7 --- tests/compute/docker/test_docker.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/compute/docker/test_docker.py b/tests/compute/docker/test_docker.py index cb6f2e4de..04b144c52 100644 --- a/tests/compute/docker/test_docker.py +++ b/tests/compute/docker/test_docker.py @@ -215,9 +215,9 @@ async def test_docker_check_connection_docker_preferred_version_against_older(vm @pytest.mark.asyncio async def test_install_busybox(): - mock_process = MagicMock(spec=asyncio.subprocess.Process) - mock_process.communicate.return_value = (b"", b"not a dynamic executable") - mock_process.returncode = 1 # means that busybox is not dynamically linked + mock_process = MagicMock() + mock_process.returncode = 1 # means that busybox is not dynamically linked + mock_process.communicate = AsyncioMagicMock(return_value=(b"", b"not a dynamic executable")) with patch("os.path.isfile", return_value=False): with patch("shutil.which", return_value="/usr/bin/busybox"): @@ -236,9 +236,9 @@ async def test_install_busybox(): @pytest.mark.asyncio async def test_install_busybox_dynamic_linked(): - mock_process = MagicMock(spec=asyncio.subprocess.Process) - mock_process.communicate.return_value = (b"Dynamically linked library", b"") + mock_process = MagicMock() mock_process.returncode = 0 # means that busybox is dynamically linked + mock_process.communicate = AsyncioMagicMock(return_value=(b"Dynamically linked library", b"")) with patch("os.path.isfile", return_value=False): with patch("shutil.which", return_value="/usr/bin/busybox"):