Skip to content

Commit

Permalink
Fix tests when running Python 3.7
Browse files Browse the repository at this point in the history
  • Loading branch information
grossmj committed Aug 11, 2023
1 parent d9eb61e commit 2f2aabe
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions tests/compute/docker/test_docker.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"):
Expand All @@ -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"):
Expand Down

0 comments on commit 2f2aabe

Please sign in to comment.