[dut_console] Fix fixture conflict in test_idle_timeout#23201
Merged
StormLiangMS merged 1 commit intosonic-net:masterfrom Mar 24, 2026
Merged
Conversation
The test_timeout function uses duthost_console fixture which depends on enum_rand_one_per_hwsku_hostname, but the test also declares enum_supervisor_dut_hostname. These two enum fixtures are mutually exclusive in pytest_generate_tests (elif chain), so only enum_supervisor_dut_hostname gets parameterized while enum_rand_one_per_hwsku_hostname does not, causing: AttributeError: SubRequest object has no attribute param Fix by changing enum_supervisor_dut_hostname to enum_rand_one_per_hwsku_hostname to match the duthost_console fixture. Signed-off-by: Zhaohui Sun <zhaohuisun@microsoft.com>
Collaborator
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
StormLiangMS
approved these changes
Mar 24, 2026
Collaborator
StormLiangMS
left a comment
There was a problem hiding this comment.
LGTM — clean fix aligning both fixtures to enum_rand_one_per_hwsku_hostname to resolve the parameterization conflict. CI all green.
Collaborator
|
hi @ZhaohuiS thanks for the fix. |
ravaliyel
pushed a commit
to ravaliyel/sonic-mgmt
that referenced
this pull request
Mar 27, 2026
) The test_timeout function uses duthost_console fixture which depends on enum_rand_one_per_hwsku_hostname, but the test also declares enum_supervisor_dut_hostname. These two enum fixtures are mutually exclusive in pytest_generate_tests (elif chain), so only enum_supervisor_dut_hostname gets parameterized while enum_rand_one_per_hwsku_hostname does not, causing: AttributeError: SubRequest object has no attribute param Fix by changing enum_supervisor_dut_hostname to enum_rand_one_per_hwsku_hostname to match the duthost_console fixture. Signed-off-by: Zhaohui Sun <zhaohuisun@microsoft.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description of PR
Summary:
Fix fixture conflict in
test_idle_timeout.pythat causesAttributeError: 'SubRequest' object has no attribute 'param'.The
test_timeoutfunction uses theduthost_consolefixture (which depends onenum_rand_one_per_hwsku_hostname), but the test also declaresenum_supervisor_dut_hostnameas a parameter. These two enum fixtures are mutually exclusive inpytest_generate_tests(elifchain inconftest.py), so onlyenum_supervisor_dut_hostnamegets parameterized whileenum_rand_one_per_hwsku_hostnamedoes not — causing the fixture to fail when accessingrequest.param.Fixes https://msazure.visualstudio.com/One/_workitems/edit/36796668
Type of change
Back port request
Approach
What is the motivation for this PR?
test_timeoutintests/dut_console/test_idle_timeout.pyalways fails with:at
conftest.py:2421inenum_rand_one_per_hwsku_hostnamefixture, because the fixture is never parameterized bypytest_generate_tests.How did you do it?
Changed
enum_supervisor_dut_hostnametoenum_rand_one_per_hwsku_hostnamein thetest_timeoutfunction signature and body. This aligns the test with theduthost_consolefixture's dependency, ensuring both use the same parameterization path inpytest_generate_tests.How did you verify/test it?
Ran the test on testbed
testbed-bjw2-can-t1-7260-12(Arista 7260CX3-64) with SONiC master image (SONiC.master.1067794-cee76d55f):AttributeError: 'SubRequest' object has no attribute 'param'(ERROR)1 passed, 35 warnings in 91.80s(PASSED)Any platform specific information?
N/A — this is a test framework fixture issue affecting all platforms.
Supported testbed topology if it's a new test case?
N/A — existing test case, topology
any.Documentation
N/A