Skip to content

Commit 2dd8ec0

Browse files
committed
WIP allow use of a callable to depend on orig_version
- now uses a single list item, so a single callable can return a all decls FIXME: - added dependencies not taken into account? - apply to firstboot - hardcoding "orig_version" feels bad for further usage => derive param name from lambda introspection? - squash?
1 parent 24afe83 commit 2dd8ec0

File tree

2 files changed

+25
-25
lines changed

2 files changed

+25
-25
lines changed

tests/install/conftest.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,14 @@ def xcpng_chained(request):
211211
# take test name from mark
212212
marker = request.node.get_closest_marker("continuation_of")
213213
assert marker is not None, "xcpng_chained fixture requires 'continuation_of' marker"
214-
continuation_of = marker.args
214+
continuation_of = marker.args[0]
215+
if callable(continuation_of):
216+
try:
217+
orig_version = request.getfixturevalue("orig_version")
218+
except pytest.FixtureLookupError as e:
219+
raise RuntimeError("'orig_version' test parameter not found") from e
220+
continuation_of = continuation_of(orig_version=orig_version)
221+
215222
vm_defs = [dict(name=vm_spec['vm'],
216223
image=shortened_nodeid(
217224
_expand_scope_relative_nodeid(vm_spec['test'],

tests/install/test.py

Lines changed: 17 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -127,25 +127,25 @@ def test_install_uefi(self, request, version, iso_remaster, create_vms):
127127
@pytest.mark.usefixtures("xcpng_chained")
128128
@pytest.mark.parametrize("mode", [
129129
pytest.param("821.1", marks=[
130-
pytest.mark.continuation_of(dict(vm="vm 1",
131-
test="TestNested::test_install_uefi[821.1]")),
130+
pytest.mark.continuation_of([dict(vm="vm 1",
131+
test="TestNested::test_install_uefi[821.1]")]),
132132
]),
133133
pytest.param("821.1_821.1", marks=[
134-
pytest.mark.continuation_of(dict(vm="vm 1",
135-
test="TestNested::test_upgrade_uefi[821.1-821.1]")),
134+
pytest.mark.continuation_of([dict(vm="vm 1",
135+
test="TestNested::test_upgrade_uefi[821.1-821.1]")]),
136136
]),
137137
pytest.param("821.1_83b2", marks=[
138-
pytest.mark.continuation_of(dict(vm="vm 1",
139-
test="TestNested::test_upgrade_uefi[821.1-83b2]")),
138+
pytest.mark.continuation_of([dict(vm="vm 1",
139+
test="TestNested::test_upgrade_uefi[821.1-83b2]")]),
140140
]),
141141
pytest.param("83b2", marks=[
142-
pytest.mark.continuation_of(dict(vm="vm 1",
143-
test="TestNested::test_install_uefi[83b2]")),
142+
pytest.mark.continuation_of([dict(vm="vm 1",
143+
test="TestNested::test_install_uefi[83b2]")]),
144144
]),
145145
# 8.3b2 disabled the upgrade from 8.3
146146
#pytest.param("83b2_83b2", marks=[
147-
# pytest.mark.continuation_of(dict(vm="vm 1",
148-
# test="TestNested::test_upgrade_uefi[83b2-83b2]")),
147+
# pytest.mark.continuation_of([dict(vm="vm 1",
148+
# test="TestNested::test_upgrade_uefi[83b2-83b2]")]),
149149
#]),
150150
])
151151
def test_firstboot_uefi(self, request, create_vms, mode):
@@ -249,20 +249,13 @@ def test_firstboot_uefi(self, request, create_vms, mode):
249249

250250
@pytest.mark.usefixtures("xcpng_chained")
251251
@pytest.mark.parametrize(("orig_version", "version"), [
252-
pytest.param("821.1", "821.1", marks=[
253-
pytest.mark.continuation_of(dict(vm="vm 1",
254-
test="TestNested::test_firstboot_uefi[821.1]")),
255-
]),
256-
pytest.param("821.1", "83b2", marks=[
257-
pytest.mark.continuation_of(dict(vm="vm 1",
258-
test="TestNested::test_firstboot_uefi[821.1]")),
259-
]),
260-
# 8.3b2 disabled the upgrade from 8.3
261-
#pytest.param("83b2", "83b2", marks=[
262-
# pytest.mark.continuation_of(dict(vm="vm 1",
263-
# test="TestNested::test_firstboot_uefi[83b2]")),
264-
#]),
252+
("821.1", "821.1"),
253+
("821.1", "83b2"),
254+
#("83b2", "83b2"), # 8.3b2 disabled the upgrade from 8.3
265255
])
256+
@pytest.mark.continuation_of(
257+
lambda orig_version: [dict(vm="vm 1",
258+
test=f"TestNested::test_firstboot_uefi[{orig_version}]")])
266259
@pytest.mark.answerfile(
267260
{
268261
"base": "UPGRADE",
@@ -271,7 +264,7 @@ def test_firstboot_uefi(self, request, create_vms, mode):
271264
})
272265
@pytest.mark.installer_iso(lambda version: {"821.1": "xcpng-8.2.1-2023",
273266
"83b2": "xcpng-8.3-beta2"}[version])
274-
def test_upgrade_uefi(self, request, iso_remaster, create_vms, orig_version, version):
267+
def test_upgrade_uefi(self, request, orig_version, version, iso_remaster, create_vms):
275268
host_vm = create_vms[0]
276269
vif = host_vm.vifs()[0]
277270
mac_address = vif.param_get('MAC')

0 commit comments

Comments
 (0)