mirror of
https://github.com/GNS3/gns3-server
synced 2024-11-24 17:28:08 +00:00
Fix tests with asyncio_patch
This commit is contained in:
parent
1fd8444d22
commit
d9eb61efc4
@ -221,7 +221,7 @@ async def test_install_busybox():
|
|||||||
|
|
||||||
with patch("os.path.isfile", return_value=False):
|
with patch("os.path.isfile", return_value=False):
|
||||||
with patch("shutil.which", return_value="/usr/bin/busybox"):
|
with patch("shutil.which", return_value="/usr/bin/busybox"):
|
||||||
with patch("asyncio.create_subprocess_exec", return_value=mock_process) as create_subprocess_mock:
|
with asyncio_patch("asyncio.create_subprocess_exec", return_value=mock_process) as create_subprocess_mock:
|
||||||
with patch("shutil.copy2") as copy2_mock:
|
with patch("shutil.copy2") as copy2_mock:
|
||||||
await Docker.install_busybox()
|
await Docker.install_busybox()
|
||||||
create_subprocess_mock.assert_called_with(
|
create_subprocess_mock.assert_called_with(
|
||||||
@ -242,7 +242,7 @@ async def test_install_busybox_dynamic_linked():
|
|||||||
|
|
||||||
with patch("os.path.isfile", return_value=False):
|
with patch("os.path.isfile", return_value=False):
|
||||||
with patch("shutil.which", return_value="/usr/bin/busybox"):
|
with patch("shutil.which", return_value="/usr/bin/busybox"):
|
||||||
with patch("asyncio.create_subprocess_exec", return_value=mock_process):
|
with asyncio_patch("asyncio.create_subprocess_exec", return_value=mock_process):
|
||||||
with pytest.raises(DockerError) as e:
|
with pytest.raises(DockerError) as e:
|
||||||
await Docker.install_busybox()
|
await Docker.install_busybox()
|
||||||
assert str(e.value) == "No busybox executable could be found"
|
assert str(e.value) == "No busybox executable could be found"
|
||||||
|
Loading…
Reference in New Issue
Block a user