refactor: use f-strings in compute tests

This commit is contained in:
Mark Paronyan 2026-09-30 20:58:12 +03:00
parent 7a9c600f54
commit bee6b3f8b1
No known key found for this signature in database
GPG Key ID: 8DC7338A87FE22F8
8 changed files with 70 additions and 76 deletions

View File

@ -189,11 +189,11 @@ async def test_linux_ethernet_raw_add_nio(linux_platform, compute_project, nio):
ubridge_mock.assert_has_calls(
[
call("bridge create {}-0".format(cloud._id)),
call("bridge add_nio_udp {}-0 4242 127.0.0.1 4343".format(cloud._id)),
call("bridge reset_packet_filters {}-0".format(cloud._id)),
call('bridge add_nio_linux_raw {}-0 "eth0"'.format(cloud._id)),
call("bridge start {}-0".format(cloud._id)),
call(f"bridge create {cloud._id}-0"),
call(f"bridge add_nio_udp {cloud._id}-0 4242 127.0.0.1 4343"),
call(f"bridge reset_packet_filters {cloud._id}-0"),
call(f'bridge add_nio_linux_raw {cloud._id}-0 "eth0"'),
call(f"bridge start {cloud._id}-0"),
]
)
@ -218,11 +218,11 @@ async def test_linux_ethernet_raw_add_nio_bridge(linux_platform, compute_project
tap = "gns3tap0-0"
ubridge_mock.assert_has_calls(
[
call("bridge create {}-0".format(cloud._id)),
call("bridge add_nio_udp {}-0 4242 127.0.0.1 4343".format(cloud._id)),
call("bridge reset_packet_filters {}-0".format(cloud._id)),
call('bridge add_nio_tap "{}-0" "{}"'.format(cloud._id, tap)),
call('brctl addif "bridge0" "{}"'.format(tap)),
call("bridge start {}-0".format(cloud._id)),
call(f"bridge create {cloud._id}-0"),
call(f"bridge add_nio_udp {cloud._id}-0 4242 127.0.0.1 4343"),
call(f"bridge reset_packet_filters {cloud._id}-0"),
call(f'bridge add_nio_tap "{cloud._id}-0" "{tap}"'),
call(f'brctl addif "bridge0" "{tap}"'),
call(f"bridge start {cloud._id}-0"),
]
)

View File

@ -51,7 +51,7 @@ async def test_query_success(vm):
data = await vm.query("POST", "test", data={"a": True}, params={"b": 1})
vm._session.request.assert_called_with(
"POST",
"http://docker/v{}/test".format(DOCKER_MINIMUM_API_VERSION),
f"http://docker/v{DOCKER_MINIMUM_API_VERSION}/test",
data='{"a": true}',
headers={"content-type": "application/json"},
params={"b": 1},
@ -76,7 +76,7 @@ async def test_query_error(vm):
await vm.query("POST", "test", data={"a": True}, params={"b": 1})
vm._session.request.assert_called_with(
"POST",
"http://docker/v{}/test".format(DOCKER_MINIMUM_API_VERSION),
f"http://docker/v{DOCKER_MINIMUM_API_VERSION}/test",
data='{"a": true}',
headers={"content-type": "application/json"},
params={"b": 1},
@ -99,7 +99,7 @@ async def test_query_error_json(vm):
await vm.query("POST", "test", data={"a": True}, params={"b": 1})
vm._session.request.assert_called_with(
"POST",
"http://docker/v{}/test".format(DOCKER_MINIMUM_API_VERSION),
f"http://docker/v{DOCKER_MINIMUM_API_VERSION}/test",
data='{"a": true}',
headers={"content-type": "application/json"},
params={"b": 1},

View File

@ -103,7 +103,7 @@ async def test_create(compute_project, manager):
await vm.create()
mock.assert_called_with(
"POST",
"containers/create?name={}".format(vm.docker_name),
f"containers/create?name={vm.docker_name}",
data={
"Tty": True,
"OpenStdin": True,
@ -145,7 +145,7 @@ async def test_create_with_tag(compute_project, manager):
await vm.create()
mock.assert_called_with(
"POST",
"containers/create?name={}".format(vm.docker_name),
f"containers/create?name={vm.docker_name}",
data={
"Tty": True,
"OpenStdin": True,
@ -192,7 +192,7 @@ async def test_create_vnc(compute_project, manager):
await vm.create()
mock.assert_called_with(
"POST",
"containers/create?name={}".format(vm.docker_name),
f"containers/create?name={vm.docker_name}",
data={
"Tty": True,
"OpenStdin": True,
@ -423,7 +423,7 @@ async def test_create_start_cmd(compute_project, manager):
await vm.create()
mock.assert_called_with(
"POST",
"containers/create?name={}".format(vm.docker_name),
f"containers/create?name={vm.docker_name}",
data={
"Tty": True,
"OpenStdin": True,
@ -520,7 +520,7 @@ async def test_create_image_digest_match(compute_project, manager):
)
await vm.create()
# the last query is the container creation: the digest check let it through
assert mock.call_args[0] == ("POST", "containers/create?name={}".format(vm.docker_name))
assert mock.call_args[0] == ("POST", f"containers/create?name={vm.docker_name}")
assert vm._cid == "sha256:" + "a" * 64
@ -554,7 +554,7 @@ async def test_create_with_user(compute_project, manager):
await vm.create()
mock.assert_called_with(
"POST",
"containers/create?name={}".format(vm.docker_name),
f"containers/create?name={vm.docker_name}",
data={
"Tty": True,
"OpenStdin": True,
@ -647,7 +647,7 @@ async def test_create_with_extra_volumes_duplicate_1_image(compute_project, mana
await vm.create()
mock.assert_called_with(
"POST",
"containers/create?name={}".format(vm.docker_name),
f"containers/create?name={vm.docker_name}",
data={
"Tty": True,
"OpenStdin": True,
@ -699,7 +699,7 @@ async def test_create_with_extra_volumes_duplicate_2_user(compute_project, manag
await vm.create()
mock.assert_called_with(
"POST",
"containers/create?name={}".format(vm.docker_name),
f"containers/create?name={vm.docker_name}",
data={
"Tty": True,
"OpenStdin": True,
@ -751,7 +751,7 @@ async def test_create_with_extra_volumes_duplicate_3_subdir(compute_project, man
await vm.create()
mock.assert_called_with(
"POST",
"containers/create?name={}".format(vm.docker_name),
f"containers/create?name={vm.docker_name}",
data={
"Tty": True,
"OpenStdin": True,
@ -803,7 +803,7 @@ async def test_create_with_extra_volumes_duplicate_4_backslash(compute_project,
await vm.create()
mock.assert_called_with(
"POST",
"containers/create?name={}".format(vm.docker_name),
f"containers/create?name={vm.docker_name}",
data={
"Tty": True,
"OpenStdin": True,
@ -853,7 +853,7 @@ async def test_create_with_extra_volumes_duplicate_5_subdir_issue_1595(compute_p
await vm.create()
mock.assert_called_with(
"POST",
"containers/create?name={}".format(vm.docker_name),
f"containers/create?name={vm.docker_name}",
data={
"Tty": True,
"OpenStdin": True,
@ -905,7 +905,7 @@ async def test_create_with_extra_volumes_duplicate_6_subdir_issue_1595(compute_p
await vm.create()
mock.assert_called_with(
"POST",
"containers/create?name={}".format(vm.docker_name),
f"containers/create?name={vm.docker_name}",
data={
"Tty": True,
"OpenStdin": True,
@ -956,7 +956,7 @@ async def test_create_with_extra_volumes(compute_project, manager):
await vm.create()
mock.assert_called_with(
"POST",
"containers/create?name={}".format(vm.docker_name),
f"containers/create?name={vm.docker_name}",
data={
"Tty": True,
"OpenStdin": True,
@ -1376,7 +1376,7 @@ async def test_update(vm):
mock_query.assert_any_call("DELETE", "containers/e90e34656842", params={"force": 1, "v": 1})
mock_query.assert_any_call(
"POST",
"containers/create?name={}".format(vm.docker_name),
f"containers/create?name={vm.docker_name}",
data={
"Tty": True,
"OpenStdin": True,
@ -1448,7 +1448,7 @@ async def test_update_running(vm):
mock_query.assert_any_call("DELETE", "containers/e90e34656842", params={"force": 1, "v": 1})
mock_query.assert_any_call(
"POST",
"containers/create?name={}".format(vm.docker_name),
f"containers/create?name={vm.docker_name}",
data={
"Tty": True,
"OpenStdin": True,
@ -1633,7 +1633,7 @@ async def test_add_ubridge_connection_no_free_interface(vm):
nio = vm.manager.create_nio(nio)
with pytest.raises(DockerError):
# We create fake ethernet interfaces for docker
interfaces = ["tap-gns3-e{}".format(index) for index in range(4096)]
interfaces = [f"tap-gns3-e{index}" for index in range(4096)]
with patch("psutil.net_if_addrs", return_value=interfaces):
await vm._add_ubridge_connection(nio, 0)
@ -1821,9 +1821,9 @@ async def test_start_vnc(vm):
"None",
"-desktop",
"test",
":{}".format(vm._display),
f":{vm._display}",
)
mock_wait.assert_called_with("/tmp/.X11-unix/X{}".format(vm._display))
mock_wait.assert_called_with(f"/tmp/.X11-unix/X{vm._display}")
@pytest.mark.asyncio
@ -1882,9 +1882,7 @@ async def test_fix_permission(vm):
"/gns3/bin/busybox",
"sh",
"-c",
'(/gns3/bin/busybox find "/etc" -depth -print0 | /gns3/bin/busybox xargs -0 /gns3/bin/busybox stat -c \'%a:%u:%g:%n\' > "/etc/.gns3_perms") && /gns3/bin/busybox chmod -R u+rX "/etc" && /gns3/bin/busybox chown {}:{} -R "/etc"'.format(
os.getuid(), os.getgid()
),
f'(/gns3/bin/busybox find "/etc" -depth -print0 | /gns3/bin/busybox xargs -0 /gns3/bin/busybox stat -c \'%a:%u:%g:%n\' > "/etc/.gns3_perms") && /gns3/bin/busybox chmod -R u+rX "/etc" && /gns3/bin/busybox chown {os.getuid()}:{os.getgid()} -R "/etc"',
stderr=asyncio.subprocess.PIPE,
)
assert process.wait.called
@ -1907,9 +1905,7 @@ async def test_fix_permission_not_running(vm):
"/gns3/bin/busybox",
"sh",
"-c",
'(/gns3/bin/busybox find "/etc" -depth -print0 | /gns3/bin/busybox xargs -0 /gns3/bin/busybox stat -c \'%a:%u:%g:%n\' > "/etc/.gns3_perms") && /gns3/bin/busybox chmod -R u+rX "/etc" && /gns3/bin/busybox chown {}:{} -R "/etc"'.format(
os.getuid(), os.getgid()
),
f'(/gns3/bin/busybox find "/etc" -depth -print0 | /gns3/bin/busybox xargs -0 /gns3/bin/busybox stat -c \'%a:%u:%g:%n\' > "/etc/.gns3_perms") && /gns3/bin/busybox chmod -R u+rX "/etc" && /gns3/bin/busybox chown {os.getuid()}:{os.getgid()} -R "/etc"',
stderr=asyncio.subprocess.PIPE,
)
assert mock_start.called
@ -2080,7 +2076,7 @@ async def test_cpus(compute_project, manager):
await vm.create()
mock.assert_called_with(
"POST",
"containers/create?name={}".format(vm.docker_name),
f"containers/create?name={vm.docker_name}",
data={
"Tty": True,
"OpenStdin": True,
@ -2122,7 +2118,7 @@ async def test_memory(compute_project, manager):
await vm.create()
mock.assert_called_with(
"POST",
"containers/create?name={}".format(vm.docker_name),
f"containers/create?name={vm.docker_name}",
data={
"Tty": True,
"OpenStdin": True,

View File

@ -56,7 +56,7 @@ def iourc_file(tmpdir):
path = str(tmpdir / "iourc")
with open(path, "w+") as f:
hostname = socket.gethostname()
f.write("[license]\n{} = aaaaaaaaaaaaaaaa;".format(hostname))
f.write(f"[license]\n{hostname} = aaaaaaaaaaaaaaaa;")
return path
@ -182,15 +182,15 @@ async def test_rename_nvram_file(vm):
It should rename the nvram file to the correct name before launching the VM
"""
with open(os.path.join(vm.working_dir, "nvram_0000{}".format(vm.application_id + 1)), "w+") as f:
with open(os.path.join(vm.working_dir, f"nvram_0000{vm.application_id + 1}"), "w+") as f:
f.write("1")
with open(os.path.join(vm.working_dir, "vlan.dat-0000{}".format(vm.application_id + 1)), "w+") as f:
with open(os.path.join(vm.working_dir, f"vlan.dat-0000{vm.application_id + 1}"), "w+") as f:
f.write("1")
vm._rename_nvram_file()
assert os.path.exists(os.path.join(vm.working_dir, "nvram_0000{}".format(vm.application_id)))
assert os.path.exists(os.path.join(vm.working_dir, "vlan.dat-0000{}".format(vm.application_id)))
assert os.path.exists(os.path.join(vm.working_dir, f"nvram_0000{vm.application_id}"))
assert os.path.exists(os.path.join(vm.working_dir, f"vlan.dat-0000{vm.application_id}"))
@pytest.mark.asyncio
@ -589,13 +589,13 @@ async def test_invalid_iou_file(vm, iourc_file):
# Missing ;
with pytest.raises(IOUError):
with open(iourc_file, "w+") as f:
f.write("[license]\n{} = aaaaaaaaaaaaaaaa".format(hostname))
f.write(f"[license]\n{hostname} = aaaaaaaaaaaaaaaa")
await vm._check_iou_license()
# Key too short
with pytest.raises(IOUError):
with open(iourc_file, "w+") as f:
f.write("[license]\n{} = aaaaaaaaaaaaaa;".format(hostname))
f.write(f"[license]\n{hostname} = aaaaaaaaaaaaaa;")
await vm._check_iou_license()
# Invalid hostname

View File

@ -384,7 +384,7 @@ async def test_disk_options(vm, tmpdir, fake_qemu_img_binary):
fake_qemu_img_binary,
"create",
"-o",
"backing_file={}".format(vm._hda_disk_image),
f"backing_file={vm._hda_disk_image}",
"-F",
"qcow2",
"-f",
@ -394,7 +394,7 @@ async def test_disk_options(vm, tmpdir, fake_qemu_img_binary):
fake_qemu_img_binary,
"create",
"-o",
"backing_file={}".format(vm._hdb_disk_image),
f"backing_file={vm._hdb_disk_image}",
"-F",
"qcow2",
"-f",
@ -449,7 +449,7 @@ async def test_uefi_boot_mode_option(vm, tmpdir, images_dir, fake_qemu_img_binar
f.write("1")
options = await vm._build_command()
assert " ".join(["-drive", "if=pflash,format=raw,readonly,file={}".format(ovmf_code_path)]) in " ".join(options)
assert " ".join(["-drive", f"if=pflash,format=raw,readonly,file={ovmf_code_path}"]) in " ".join(options)
assert " ".join(
["-drive", "if=pflash,format=raw,file={}".format(os.path.join(vm.working_dir, "OVMF_VARS_4M.fd"))]
) in " ".join(options)
@ -490,7 +490,7 @@ async def test_tpm_option(vm, tmpdir, fake_qemu_img_binary):
tpm_sock = os.path.join(vm.temporary_directory, "swtpm.sock")
with patch("os.path.exists", return_value=True) as os_path:
options = await vm._build_command()
assert "-chardev socket,id=chrtpm,path={}".format(tpm_sock) in " ".join(options)
assert f"-chardev socket,id=chrtpm,path={tpm_sock}" in " ".join(options)
assert "-tpmdev emulator,id=tpm0,chardev=chrtpm" in " ".join(options)
assert "-device tpm-tis,tpmdev=tpm0" in " ".join(options)
@ -608,7 +608,7 @@ async def test_build_command(vm, fake_qemu_binary):
"-uuid",
vm.id,
"-serial",
"telnet:127.0.0.1:{},server,nowait".format(vm._internal_console_port),
f"telnet:127.0.0.1:{vm._internal_console_port},server,nowait",
"-net",
"none",
"-device",
@ -616,9 +616,9 @@ async def test_build_command(vm, fake_qemu_binary):
"-device",
"pci-bridge,id=pci-bridge1,bus=dmi_pci_bridge1,chassis_nr=0x1,addr=0x1,shpc=off",
"-device",
"e1000,mac={},bus=pci-bridge1,addr=0x00,netdev=gns3-0".format(vm._mac_address),
f"e1000,mac={vm._mac_address},bus=pci-bridge1,addr=0x00,netdev=gns3-0",
"-netdev",
"socket,id=gns3-0,udp=127.0.0.1:{},localaddr=127.0.0.1:{}".format(nio.rport, nio.lport),
f"socket,id=gns3-0,udp=127.0.0.1:{nio.rport},localaddr=127.0.0.1:{nio.lport}",
"-display",
"none",
]
@ -679,7 +679,7 @@ async def test_build_command_kvm_2_4(linux_platform, vm, fake_qemu_binary):
"-uuid",
vm.id,
"-serial",
"telnet:127.0.0.1:{},server,nowait".format(vm._internal_console_port),
f"telnet:127.0.0.1:{vm._internal_console_port},server,nowait",
"-net",
"none",
"-device",
@ -687,9 +687,9 @@ async def test_build_command_kvm_2_4(linux_platform, vm, fake_qemu_binary):
"-device",
"pci-bridge,id=pci-bridge1,bus=dmi_pci_bridge1,chassis_nr=0x1,addr=0x1,shpc=off",
"-device",
"e1000,mac={},bus=pci-bridge1,addr=0x00,netdev=gns3-0".format(vm._mac_address),
f"e1000,mac={vm._mac_address},bus=pci-bridge1,addr=0x00,netdev=gns3-0",
"-netdev",
"socket,id=gns3-0,udp=127.0.0.1:{},localaddr=127.0.0.1:{}".format(nio.rport, nio.lport),
f"socket,id=gns3-0,udp=127.0.0.1:{nio.rport},localaddr=127.0.0.1:{nio.lport}",
"-nographic",
]
@ -727,7 +727,7 @@ async def test_build_command_two_adapters(vm, fake_qemu_binary):
"-uuid",
vm.id,
"-serial",
"telnet:127.0.0.1:{},server,nowait".format(vm._internal_console_port),
f"telnet:127.0.0.1:{vm._internal_console_port},server,nowait",
"-net",
"none",
"-device",
@ -735,15 +735,13 @@ async def test_build_command_two_adapters(vm, fake_qemu_binary):
"-device",
"pci-bridge,id=pci-bridge1,bus=dmi_pci_bridge1,chassis_nr=0x1,addr=0x1,shpc=off",
"-device",
"e1000,mac={},bus=pci-bridge1,addr=0x00,netdev=gns3-0".format(vm._mac_address),
f"e1000,mac={vm._mac_address},bus=pci-bridge1,addr=0x00,netdev=gns3-0",
"-netdev",
"socket,id=gns3-0,udp=127.0.0.1:{},localaddr=127.0.0.1:{}".format(nio1.rport, nio1.lport),
f"socket,id=gns3-0,udp=127.0.0.1:{nio1.rport},localaddr=127.0.0.1:{nio1.lport}",
"-device",
"e1000,mac={},bus=pci-bridge1,addr=0x01,netdev=gns3-1".format(
int_to_macaddress(macaddress_to_int(vm._mac_address) + 1)
),
f"e1000,mac={int_to_macaddress(macaddress_to_int(vm._mac_address) + 1)},bus=pci-bridge1,addr=0x01,netdev=gns3-1",
"-netdev",
"socket,id=gns3-1,udp=127.0.0.1:{},localaddr=127.0.0.1:{}".format(nio2.rport, nio2.lport),
f"socket,id=gns3-1,udp=127.0.0.1:{nio2.rport},localaddr=127.0.0.1:{nio2.lport}",
"-nographic",
]
@ -761,8 +759,8 @@ async def test_build_command_two_adapters_mac_address(vm):
assert mac_0[:8] == "00:00:ab"
with asyncio_patch("asyncio.create_subprocess_exec", return_value=MagicMock()):
cmd = await vm._build_command()
assert "e1000,mac={},bus=pci-bridge1,addr=0x00,netdev=gns3-0".format(mac_0) in cmd
assert "e1000,mac={},bus=pci-bridge1,addr=0x01,netdev=gns3-1".format(mac_1) in cmd
assert f"e1000,mac={mac_0},bus=pci-bridge1,addr=0x00,netdev=gns3-0" in cmd
assert f"e1000,mac={mac_1},bus=pci-bridge1,addr=0x01,netdev=gns3-1" in cmd
vm.mac_address = "00:42:ab:0e:0f:0a"
mac_0 = vm._mac_address
@ -770,8 +768,8 @@ async def test_build_command_two_adapters_mac_address(vm):
assert mac_0[:8] == "00:42:ab"
with asyncio_patch("asyncio.create_subprocess_exec", return_value=MagicMock()):
cmd = await vm._build_command()
assert "e1000,mac={},bus=pci-bridge1,addr=0x00,netdev=gns3-0".format(mac_0) in cmd
assert "e1000,mac={},bus=pci-bridge1,addr=0x01,netdev=gns3-1".format(mac_1) in cmd
assert f"e1000,mac={mac_0},bus=pci-bridge1,addr=0x00,netdev=gns3-0" in cmd
assert f"e1000,mac={mac_1},bus=pci-bridge1,addr=0x01,netdev=gns3-1" in cmd
@pytest.mark.asyncio
@ -793,19 +791,19 @@ async def test_build_command_large_number_of_adapters(vm):
assert len([l for l in cmd if "e1000" in l]) == 100
assert len(vm._ethernet_adapters) == 100
assert "e1000,mac={},bus=pci-bridge1,addr=0x00,netdev=gns3-0".format(mac_0) in cmd
assert "e1000,mac={},bus=pci-bridge1,addr=0x01,netdev=gns3-1".format(mac_1) in cmd
assert f"e1000,mac={mac_0},bus=pci-bridge1,addr=0x00,netdev=gns3-0" in cmd
assert f"e1000,mac={mac_1},bus=pci-bridge1,addr=0x01,netdev=gns3-1" in cmd
assert "pci-bridge,id=pci-bridge0,bus=dmi_pci_bridge0,chassis_nr=0x1,addr=0x0,shpc=off" not in cmd
assert "pci-bridge,id=pci-bridge1,bus=dmi_pci_bridge1,chassis_nr=0x1,addr=0x1,shpc=off" in cmd
assert "pci-bridge,id=pci-bridge2,bus=dmi_pci_bridge2,chassis_nr=0x1,addr=0x2,shpc=off" in cmd
assert "i82801b11-bridge,id=dmi_pci_bridge1" in cmd
mac_29 = int_to_macaddress(macaddress_to_int(vm._mac_address) + 29)
assert "e1000,mac={},bus=pci-bridge1,addr=0x1d,netdev=gns3-29".format(mac_29) in cmd
assert f"e1000,mac={mac_29},bus=pci-bridge1,addr=0x1d,netdev=gns3-29" in cmd
mac_30 = int_to_macaddress(macaddress_to_int(vm._mac_address) + 30)
assert "e1000,mac={},bus=pci-bridge1,addr=0x1e,netdev=gns3-30".format(mac_30) in cmd
assert f"e1000,mac={mac_30},bus=pci-bridge1,addr=0x1e,netdev=gns3-30" in cmd
mac_74 = int_to_macaddress(macaddress_to_int(vm._mac_address) + 74)
assert "e1000,mac={},bus=pci-bridge3,addr=0x0a,netdev=gns3-74".format(mac_74) in cmd
assert f"e1000,mac={mac_74},bus=pci-bridge3,addr=0x0a,netdev=gns3-74" in cmd
@pytest.mark.asyncio

View File

@ -91,7 +91,7 @@ async def test_list_vms(manager):
return ["memory=512"]
elif args[0] == "ccd8c50b-c172-457d-99fa-dd69371ede0e":
return ["memory=256"]
assert False, "Unknow {} {}".format(cmd, args)
assert False, f"Unknow {cmd} {args}"
with asyncio_patch("gns3server.compute.virtualbox.VirtualBox.execute") as mock:
mock.side_effect = execute_mock

View File

@ -74,5 +74,5 @@ async def test_get_mac_id_no_id_available(compute_project, port_manager):
with pytest.raises(VPCSError):
for i in range(0, 256):
node_id = str(uuid.uuid4())
await vpcs.create_node("PC {}".format(i), compute_project.id, node_id)
await vpcs.create_node(f"PC {i}", compute_project.id, node_id)
assert vpcs.get_mac_id(node_id) == i

View File

@ -298,7 +298,7 @@ def test_update_startup_script_with_escaping_characters_in_name(vm):
vm.startup_script = "set pcname initial-name\n"
vm.name = "test\\"
assert vm.startup_script == "set pcname test{}".format(os.linesep)
assert vm.startup_script == f"set pcname test{os.linesep}"
def test_get_startup_script(vm):