Skip to content

[dut_console] Fix fixture conflict in test_idle_timeout#23201

Merged
StormLiangMS merged 1 commit intosonic-net:masterfrom
ZhaohuiS:fix/test-idle-timeout-fixture-conflict
Mar 24, 2026
Merged

[dut_console] Fix fixture conflict in test_idle_timeout#23201
StormLiangMS merged 1 commit intosonic-net:masterfrom
ZhaohuiS:fix/test-idle-timeout-fixture-conflict

Conversation

@ZhaohuiS
Copy link
Copy Markdown
Contributor

Description of PR

Summary:
Fix fixture conflict in test_idle_timeout.py that causes AttributeError: 'SubRequest' object has no attribute 'param'.

The test_timeout function uses the duthost_console fixture (which depends on enum_rand_one_per_hwsku_hostname), but the test also declares enum_supervisor_dut_hostname as a parameter. These two enum fixtures are mutually exclusive in pytest_generate_tests (elif chain in conftest.py), so only enum_supervisor_dut_hostname gets parameterized while enum_rand_one_per_hwsku_hostname does not — causing the fixture to fail when accessing request.param.

Fixes https://msazure.visualstudio.com/One/_workitems/edit/36796668

Type of change

  • Bug fix
  • Testbed and Framework(new/improvement)
  • New Test case
    • Skipped for non-supported platforms
  • Test case improvement

Back port request

  • 202205
  • 202305
  • 202311
  • 202405
  • 202411
  • 202505
  • 202511

Approach

What is the motivation for this PR?

test_timeout in tests/dut_console/test_idle_timeout.py always fails with:

AttributeError: 'SubRequest' object has no attribute 'param'

at conftest.py:2421 in enum_rand_one_per_hwsku_hostname fixture, because the fixture is never parameterized by pytest_generate_tests.

How did you do it?

Changed enum_supervisor_dut_hostname to enum_rand_one_per_hwsku_hostname in the test_timeout function signature and body. This aligns the test with the duthost_console fixture's dependency, ensuring both use the same parameterization path in pytest_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):

  • Before fix: AttributeError: 'SubRequest' object has no attribute 'param' (ERROR)
  • After fix: 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

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>
@mssonicbld
Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

Copy link
Copy Markdown
Contributor

@yanmo96 yanmo96 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Copy Markdown
Collaborator

@StormLiangMS StormLiangMS left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM — clean fix aligning both fixtures to enum_rand_one_per_hwsku_hostname to resolve the parameterization conflict. CI all green.

@StormLiangMS StormLiangMS merged commit aeda3d7 into sonic-net:master Mar 24, 2026
17 checks passed
@StormLiangMS StormLiangMS added the Request for 202511 branch Request to backport a change to 202511 branch label Mar 24, 2026
@StormLiangMS
Copy link
Copy Markdown
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Request for 202511 branch Request to backport a change to 202511 branch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants