Skip to content

Commit b6ee0eb

Browse files
committed
conftest: stop using a test parameter for second_network
Signed-off-by: Yann Dirson <[email protected]>
1 parent 52238d2 commit b6ee0eb

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

conftest.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -422,10 +422,11 @@ def additional_repos(request, hosts):
422422
host_.ssh(['rm', '-f', repo_file])
423423

424424
@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]
429430
pif_uuid = host.xe('pif-list', {'host-uuid': host.uuid, 'network-uuid': network_uuid}, minimal=True)
430431
if not pif_uuid:
431432
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):
450451
# For us it means use the defaults.
451452
configs = [None]
452453
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")
456454

457455
def pytest_collection_modifyitems(items, config):
458456
# Automatically mark tests based on fixtures they require.

0 commit comments

Comments
 (0)