1
0
mirror of https://github.com/GNS3/gns3-server synced 2024-11-28 11:18:11 +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 LICENSE
include MANIFEST.in

View File

@ -30,7 +30,10 @@ from unittest.mock import patch, MagicMock
@pytest.fixture
def fake_qemu_img_binary(tmpdir):
bin_path = str(tmpdir / "qemu-img")
if sys.platform.startswith("win"):
bin_path = str(tmpdir / "qemu-img.EXE")
else:
bin_path = str(tmpdir / "qemu-img")
with open(bin_path, "w+") as f:
f.write("1")
os.chmod(bin_path, stat.S_IRUSR | stat.S_IWUSR | stat.S_IXUSR)

View File

@ -45,7 +45,10 @@ async def manager(port_manager):
def fake_qemu_img_binary(monkeypatch, tmpdir):
monkeypatch.setenv("PATH", str(tmpdir))
bin_path = os.path.join(os.environ["PATH"], "qemu-img")
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")
with open(bin_path, "w+") as f:
f.write("1")
os.chmod(bin_path, stat.S_IRUSR | stat.S_IWUSR | stat.S_IXUSR)
@ -865,7 +868,10 @@ def test_get_qemu_img(vm, tmpdir):
open(str(tmpdir / "qemu-system-x86_64"), "w+").close()
open(str(tmpdir / "qemu-img"), "w+").close()
vm._qemu_path = str(tmpdir / "qemu-system-x86_64")
assert vm._get_qemu_img() == str(tmpdir / "qemu-img")
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")
# def test_get_qemu_img_not_exist(vm, tmpdir):

View File