1
0
mirror of https://github.com/GNS3/gns3-server synced 2024-11-25 01:38:08 +00:00

Merge branch '2.2' into 3.0

# Conflicts:
#	README.md
#	README.rst
#	tests/handlers/api/compute/test_nat.py
This commit is contained in:
grossmj 2023-01-10 11:52:58 +08:00
commit f09594ae4c
4 changed files with 13 additions and 4 deletions

View File

@ -1,4 +1,4 @@
include README.rst include README.md
include AUTHORS include AUTHORS
include LICENSE include LICENSE
include MANIFEST.in include MANIFEST.in

View File

@ -30,6 +30,9 @@ from unittest.mock import patch, MagicMock
@pytest.fixture @pytest.fixture
def fake_qemu_img_binary(tmpdir): def fake_qemu_img_binary(tmpdir):
if sys.platform.startswith("win"):
bin_path = str(tmpdir / "qemu-img.EXE")
else:
bin_path = str(tmpdir / "qemu-img") bin_path = str(tmpdir / "qemu-img")
with open(bin_path, "w+") as f: with open(bin_path, "w+") as f:
f.write("1") f.write("1")

View File

@ -45,6 +45,9 @@ async def manager(port_manager):
def fake_qemu_img_binary(monkeypatch, tmpdir): def fake_qemu_img_binary(monkeypatch, tmpdir):
monkeypatch.setenv("PATH", str(tmpdir)) monkeypatch.setenv("PATH", str(tmpdir))
if sys.platform.startswith("win"):
bin_path = os.path.join(os.environ["PATH"], "qemu-img.EXE")
else:
bin_path = os.path.join(os.environ["PATH"], "qemu-img") bin_path = os.path.join(os.environ["PATH"], "qemu-img")
with open(bin_path, "w+") as f: with open(bin_path, "w+") as f:
f.write("1") f.write("1")
@ -865,6 +868,9 @@ def test_get_qemu_img(vm, tmpdir):
open(str(tmpdir / "qemu-system-x86_64"), "w+").close() open(str(tmpdir / "qemu-system-x86_64"), "w+").close()
open(str(tmpdir / "qemu-img"), "w+").close() open(str(tmpdir / "qemu-img"), "w+").close()
vm._qemu_path = str(tmpdir / "qemu-system-x86_64") vm._qemu_path = str(tmpdir / "qemu-system-x86_64")
if sys.platform.startswith("win"):
assert vm._get_qemu_img() == str(tmpdir / "qemu-img.EXE")
else:
assert vm._get_qemu_img() == str(tmpdir / "qemu-img") assert vm._get_qemu_img() == str(tmpdir / "qemu-img")

View File