1
0
mirror of https://github.com/GNS3/gns3-server synced 2024-12-26 00:38:10 +00:00

Fix tests when running Python 3.7

This commit is contained in:
grossmj 2023-08-11 17:58:00 +10:00
parent d9eb61efc4
commit 2f2aabeb5a

View File

@ -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"):