Skip to content

Commit

Permalink
update package fixture to module level for iface_loopback_action (#7593)
Browse files Browse the repository at this point in the history
iface_loopback_action folder was new added in #5871.
It uses package level fixture which will run the conftest before sanity check.
In ports_configuration it did some remove vlan member or portchannel member operation, which will cause the following sanity check failure obviously.

What is the motivation for this PR?
Make sanity check run before conftest of iface loopback action.

How did you do it?
Use module level fixture instead.

Signed-off-by: Zhaohui Sun <[email protected]>
  • Loading branch information
ZhaohuiS authored Feb 28, 2023
1 parent c2a86d2 commit d7c4c6e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion tests/common/fixtures/duthost_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def backup_and_restore_config_db_module(duthosts, rand_one_dut_hostname):
yield func


@pytest.fixture(scope="package")
@pytest.fixture(scope="module")
def backup_and_restore_config_db_package(duthosts):

for func in _backup_and_restore_config_db(duthosts, "package"):
Expand Down
8 changes: 4 additions & 4 deletions tests/iface_loopback_action/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def pytest_addoption(parser):
)


@pytest.fixture(scope="package")
@pytest.fixture(scope="module")
def orig_ports_configuration(request, duthost, ptfhost, tbinfo):
"""
Get the ports used to do test, return the dict of the port's original vlan, portchannel, infos.
Expand Down Expand Up @@ -68,7 +68,7 @@ def orig_ports_configuration(request, duthost, ptfhost, tbinfo):
yield port_dict


@pytest.fixture(scope="package")
@pytest.fixture(scope="module")
def ports_configuration(orig_ports_configuration):
"""
Define the ports parameters
Expand Down Expand Up @@ -181,7 +181,7 @@ def generate_ip_list():
return dut_ip_list, ptf_ip_list


@pytest.fixture(scope="package", autouse=True)
@pytest.fixture(scope="module", autouse=True)
def setup(duthost, ptfhost, orig_ports_configuration, ports_configuration,
backup_and_restore_config_db_package, nbrhosts, tbinfo): # noqa: F811
"""
Expand All @@ -208,7 +208,7 @@ def setup(duthost, ptfhost, orig_ports_configuration, ports_configuration,
vm_host.no_shutdown(peer_port)


@pytest.fixture(scope="package", autouse=True)
@pytest.fixture(scope="module", autouse=True)
def recover(duthost, ptfhost, ports_configuration):
"""
restore the original configurations
Expand Down

0 comments on commit d7c4c6e

Please sign in to comment.