1
0
mirror of https://github.com/GNS3/gns3-server synced 2024-11-24 17:28:08 +00:00

Fix tests

This commit is contained in:
grossmj 2023-01-10 10:07:26 +08:00
parent 78c301653f
commit e9c95ff299
2 changed files with 8 additions and 2 deletions

View File

@ -31,6 +31,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(loop, 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")