@@ -422,10 +422,11 @@ def additional_repos(request, hosts):
422
422
host_ .ssh (['rm' , '-f' , repo_file ])
423
423
424
424
@pytest .fixture (scope = 'session' )
425
- def second_network (request , host ):
426
- if request .param is None :
427
- pytest .fail ("This test requires the --second-network parameter!" )
428
- network_uuid = request .param
425
+ def second_network (pytestconfig , host ):
426
+ network_uuids = pytestconfig .getoption ("second_network" )
427
+ if len (network_uuids ) != 1 :
428
+ pytest .fail ("This test requires exactly one --second-network parameter!" )
429
+ network_uuid = network_uuids [0 ]
429
430
pif_uuid = host .xe ('pif-list' , {'host-uuid' : host .uuid , 'network-uuid' : network_uuid }, minimal = True )
430
431
if not pif_uuid :
431
432
pytest .fail ("The provided --second-network UUID doesn't exist or doesn't have a PIF on master host" )
@@ -450,9 +451,6 @@ def pytest_generate_tests(metafunc):
450
451
# For us it means use the defaults.
451
452
configs = [None ]
452
453
metafunc .parametrize ("sr_device_config" , configs , indirect = True , scope = "session" )
453
- if "second_network" in metafunc .fixturenames :
454
- second_network = metafunc .config .getoption ("second_network" )
455
- metafunc .parametrize ("second_network" , [second_network ], indirect = True , scope = "session" )
456
454
457
455
def pytest_collection_modifyitems (items , config ):
458
456
# Automatically mark tests based on fixtures they require.
0 commit comments