Skip to content

Commit d4f38c1

Browse files
authored
Add a new marker to selectively skip health check and conf restore (#6353)
As part of PR #5817, DUT health and config diff check is being ignored by tests that are hardcoded in conftest.py file. In this PR, a new marker is introduced that will skip the fixture's execution. Using this approach, the conftest.py file does not need explicit mention of test cases names. Any testcase can use this marker and skip this fixture without modifcation to conftest.py file. This would help in limiting to using one marker (vs unique marker for every case to be skipped) Keep conftest file's logic generic.
1 parent 78cc93d commit d4f38c1

File tree

4 files changed

+6
-3
lines changed

4 files changed

+6
-3
lines changed

tests/conftest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1674,7 +1674,7 @@ def check_dut_health_status(duthosts, request):
16741674
if hasattr(request.config.option, 'enable_macsec') and request.config.option.enable_macsec:
16751675
check_flag = False
16761676
for m in request.node.iter_markers():
1677-
if m.name == "pretest" or m.name == "posttest":
1677+
if m.name == "skip_check_dut_health":
16781678
check_flag = False
16791679

16801680
module_name = request.node.name

tests/pytest.ini

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ markers:
1212
topology: specify which topology testcase can be executed on: (t0, t1, ptf, etc)
1313
platform: specify which platform testcase can be executed on: (physical, virtual, broadcom, mellanox, etc)
1414
supported_completeness_level: test supported levels of completeness (coverage) level (Debug, Basic, Confident, Thorough)
15+
skip_check_dut_health: skip default execution of check_dut_health_status fixture
1516

1617
log_cli_format: %(asctime)s %(funcNamewithModule)-40.40s L%(lineno)-.4d %(levelname)-7s| %(message)s
1718
log_file_format: %(asctime)s %(funcNamewithModule)-40.40s L%(lineno)-.4d %(levelname)-7s| %(message)s

tests/test_posttest.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@
99
pytest.mark.posttest,
1010
pytest.mark.topology('util'),
1111
pytest.mark.sanity_check(skip_sanity=True),
12-
pytest.mark.disable_loganalyzer
12+
pytest.mark.disable_loganalyzer,
13+
pytest.mark.skip_check_dut_health
1314
]
1415

1516

tests/test_pretest.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@
2222
pytestmark = [
2323
pytest.mark.pretest,
2424
pytest.mark.topology('util'),
25-
pytest.mark.disable_loganalyzer
25+
pytest.mark.disable_loganalyzer,
26+
pytest.mark.skip_check_dut_health
2627
]
2728

2829

0 commit comments

Comments
 (0)