mirror of
https://github.com/GNS3/gns3-server.git
synced 2026-11-06 07:11:13 +02:00
Remove Qemu binary requirement
This commit is contained in:
1 parent
2ee9232ac5
commit
2535e5508d
6 files changed
+27
-95
No files matched your search
@@ -82,29 +82,29 @@ async def test_binary_list(monkeypatch, tmpdir):
|
||||
assert {"path": os.path.join(os.environ["PATH"], "hello"), "version": version} not in qemus
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_img_binary_list(monkeypatch, tmpdir):
|
||||
|
||||
monkeypatch.setenv("PATH", str(tmpdir))
|
||||
files_to_create = ["qemu-img", "qemu-io", "qemu-system-x86", "qemu-system-x42", "qemu-kvm", "hello"]
|
||||
|
||||
for file_to_create in files_to_create:
|
||||
path = os.path.join(os.environ["PATH"], file_to_create)
|
||||
with open(path, "w+") as f:
|
||||
f.write("1")
|
||||
os.chmod(path, stat.S_IRUSR | stat.S_IWUSR | stat.S_IXUSR)
|
||||
|
||||
with asyncio_patch("gns3server.compute.qemu.subprocess_check_output", return_value="qemu-img version 2.2.0, Copyright (c) 2004-2008 Fabrice Bellard") as mock:
|
||||
qemus = await Qemu.img_binary_list()
|
||||
|
||||
version = "2.2.0"
|
||||
|
||||
assert {"path": os.path.join(os.environ["PATH"], "qemu-img"), "version": version} in qemus
|
||||
assert {"path": os.path.join(os.environ["PATH"], "qemu-io"), "version": version} not in qemus
|
||||
assert {"path": os.path.join(os.environ["PATH"], "qemu-system-x86"), "version": version} not in qemus
|
||||
assert {"path": os.path.join(os.environ["PATH"], "qemu-kvm"), "version": version} not in qemus
|
||||
assert {"path": os.path.join(os.environ["PATH"], "qemu-system-x42"), "version": version} not in qemus
|
||||
assert {"path": os.path.join(os.environ["PATH"], "hello"), "version": version} not in qemus
|
||||
# @pytest.mark.asyncio
|
||||
# async def test_img_binary_list(monkeypatch, tmpdir):
|
||||
#
|
||||
# monkeypatch.setenv("PATH", str(tmpdir))
|
||||
# files_to_create = ["qemu-img", "qemu-io", "qemu-system-x86", "qemu-system-x42", "qemu-kvm", "hello"]
|
||||
#
|
||||
# for file_to_create in files_to_create:
|
||||
# path = os.path.join(os.environ["PATH"], file_to_create)
|
||||
# with open(path, "w+") as f:
|
||||
# f.write("1")
|
||||
# os.chmod(path, stat.S_IRUSR | stat.S_IWUSR | stat.S_IXUSR)
|
||||
#
|
||||
# with asyncio_patch("gns3server.compute.qemu.subprocess_check_output", return_value="qemu-img version 2.2.0, Copyright (c) 2004-2008 Fabrice Bellard") as mock:
|
||||
# qemus = await Qemu.img_binary_list()
|
||||
#
|
||||
# version = "2.2.0"
|
||||
#
|
||||
# assert {"path": os.path.join(os.environ["PATH"], "qemu-img"), "version": version} in qemus
|
||||
# assert {"path": os.path.join(os.environ["PATH"], "qemu-io"), "version": version} not in qemus
|
||||
# assert {"path": os.path.join(os.environ["PATH"], "qemu-system-x86"), "version": version} not in qemus
|
||||
# assert {"path": os.path.join(os.environ["PATH"], "qemu-kvm"), "version": version} not in qemus
|
||||
# assert {"path": os.path.join(os.environ["PATH"], "qemu-system-x42"), "version": version} not in qemus
|
||||
# assert {"path": os.path.join(os.environ["PATH"], "hello"), "version": version} not in qemus
|
||||
|
||||
|
||||
def test_get_legacy_vm_workdir():
|
||||
|
||||
Reference in new issue
Block a user