Skip to content

Commit 0566a19

Browse files
committed
fix typehints in install tests
Signed-off-by: Gaëtan Lehmann <[email protected]>
1 parent cfc760d commit 0566a19

File tree

3 files changed

+12
-9
lines changed

3 files changed

+12
-9
lines changed

tests/install/conftest.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import logging
22
import os
3+
from typing import Sequence
34
import pytest
45
import pytest_dependency # type: ignore
56
import tempfile
@@ -329,6 +330,7 @@ def xcpng_chained(request):
329330
marker = request.node.get_closest_marker("continuation_of")
330331
assert marker is not None, "xcpng_chained fixture requires 'continuation_of' marker"
331332
continuation_of = callable_marker(marker.args[0], request)
333+
assert isinstance(continuation_of, Sequence)
332334

333335
vm_defs = [dict(name=vm_spec['vm'],
334336
image_test=vm_spec['image_test'],

tests/install/test.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ class TestNested:
7777
cd_vbd=dict(device="xvdd", userdevice="3"),
7878
vifs=[dict(index=0, network_name=NETWORKS["MGMT"])],
7979
))
80-
@pytest.mark.answerfile(
80+
@pytest.mark.answerfile.with_args(
8181
lambda install_disk, local_sr, package_source, iso_version: AnswerFile("INSTALL")
8282
.top_setattr({} if local_sr == "nosr" else {"sr-type": local_sr})
8383
.top_append(
@@ -109,7 +109,7 @@ def test_install(self, vm_booted_with_installer, install_disk,
109109
"xs70",
110110
))
111111
@pytest.mark.parametrize("firmware", ("uefi", "bios"))
112-
@pytest.mark.continuation_of(
112+
@pytest.mark.continuation_of.with_args(
113113
lambda version, firmware, local_sr, package_source: [dict(
114114
vm="vm1",
115115
image_test=f"TestNested::test_install[{firmware}-{version}-{package_source}-{local_sr}]")])
@@ -243,6 +243,7 @@ def _test_firstboot(self, create_vms, mode, *, machine='DEFAULT', is_restore=Fal
243243
raise AssertionError(f"Unhandled LSB release {lsb_rel!r}")
244244
# check for firstboot issues
245245
# FIXME: flaky, must check logs extraction on failure
246+
stamp = ''
246247
try:
247248
for stamp in sorted(STAMPS):
248249
wait_for(lambda: pool.master.ssh(["test", "-e", f"{STAMPS_DIR}/{stamp}"],
@@ -300,7 +301,7 @@ def _test_firstboot(self, create_vms, mode, *, machine='DEFAULT', is_restore=Fal
300301
"xs70",
301302
))
302303
@pytest.mark.parametrize("firmware", ("uefi", "bios"))
303-
@pytest.mark.continuation_of(
304+
@pytest.mark.continuation_of.with_args(
304305
lambda firmware, version, machine, local_sr, package_source: [
305306
dict(vm="vm1",
306307
image_test=("TestNested::test_tune_firstboot"
@@ -327,11 +328,11 @@ def test_boot_inst(self, create_vms,
327328
("821.1", "821.1"),
328329
])
329330
@pytest.mark.parametrize("firmware", ("uefi", "bios"))
330-
@pytest.mark.continuation_of(
331+
@pytest.mark.continuation_of.with_args(
331332
lambda firmware, orig_version, machine, package_source, local_sr: [dict(
332333
vm="vm1",
333334
image_test=f"TestNested::test_boot_inst[{firmware}-{orig_version}-{machine}-{package_source}-{local_sr}]")])
334-
@pytest.mark.answerfile(
335+
@pytest.mark.answerfile.with_args(
335336
lambda install_disk, package_source, iso_version: AnswerFile("UPGRADE").top_append(
336337
{"TAG": "source", "type": "local"} if package_source == "iso"
337338
else {"TAG": "source", "type": "url",
@@ -363,7 +364,7 @@ def test_upgrade(self, vm_booted_with_installer, install_disk,
363364
"821.1-821.1",
364365
))
365366
@pytest.mark.parametrize("firmware", ("uefi", "bios"))
366-
@pytest.mark.continuation_of(
367+
@pytest.mark.continuation_of.with_args(
367368
lambda firmware, mode, machine, package_source, local_sr: [dict(
368369
vm="vm1",
369370
image_test=(f"TestNested::test_upgrade[{firmware}-{mode}-{machine}-{package_source}-{local_sr}]"))])
@@ -388,7 +389,7 @@ def test_boot_upg(self, create_vms,
388389
("821.1-821.1", "821.1"),
389390
])
390391
@pytest.mark.parametrize("firmware", ("uefi", "bios"))
391-
@pytest.mark.continuation_of(
392+
@pytest.mark.continuation_of.with_args(
392393
lambda firmware, orig_version, local_sr, package_source: [dict(
393394
vm="vm1",
394395
image_test=f"TestNested::test_boot_upg[{firmware}-{orig_version}-host1-{package_source}-{local_sr}]")])
@@ -419,7 +420,7 @@ def test_restore(self, vm_booted_with_installer, install_disk,
419420
"821.1-821.1-821.1",
420421
))
421422
@pytest.mark.parametrize("firmware", ("uefi", "bios"))
422-
@pytest.mark.continuation_of(
423+
@pytest.mark.continuation_of.with_args(
423424
lambda firmware, mode, package_source, local_sr: [dict(
424425
vm="vm1",
425426
image_test=(f"TestNested::test_restore[{firmware}-{mode}-{package_source}-{local_sr}]"))])

tests/install/test_fixtures.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
# test the answerfile fixture can run on 2 parametrized instances
77
# of the test in one run
8-
@pytest.mark.answerfile(lambda: AnswerFile("INSTALL").top_append(
8+
@pytest.mark.answerfile.with_args(lambda: AnswerFile("INSTALL").top_append(
99
{"TAG": "source", "type": "local"},
1010
{"TAG": "primary-disk", "CONTENTS": "nvme0n1"},
1111
))

0 commit comments

Comments
 (0)