From 76dc9420cf130ad976628a802dec76c13189a0be Mon Sep 17 00:00:00 2001 From: andywongarista <78833093+andywongarista@users.noreply.github.com> Date: Fri, 15 Sep 2023 18:22:23 -0700 Subject: [PATCH] Fix test_route_flow_counter (#9958) What is the motivation for this PR? When test_route_flow_counter is ran on unsupported platform, it fails due to clear_route_flow_counter fixture running which assumes that platform is supported. Independent pytest fixtures can run even if one causes the test function to skip. The clear_route_flow_counter fixture should not run if the test is skipped (due to lack of support) so the appropriate fixture arg should be included to mark the dependency. How did you do it? Added skip_if_not_supported as a dependency of clear_route_flow_counter. By doing this, if test is skipped because there is a lack of support then clear_route_flow_counter will not run. How did you verify/test it? Verified that test is skipped on unsupported platform --- tests/route/test_route_flow_counter.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/route/test_route_flow_counter.py b/tests/route/test_route_flow_counter.py index e151b521c9e..a5a7310e4e3 100644 --- a/tests/route/test_route_flow_counter.py +++ b/tests/route/test_route_flow_counter.py @@ -45,7 +45,7 @@ def skip_if_not_supported(is_route_flow_counter_supported): # noqa F811 @pytest.fixture(scope='function', autouse=True) -def clear_route_flow_counter(rand_selected_dut): +def clear_route_flow_counter(rand_selected_dut, skip_if_not_supported): """Clear route flow counter configuration Args: