Skip to content

Update ixia_fixture to fix collection errors#2570

Merged
bingwang-ms merged 2 commits intosonic-net:masterfrom
bingwang-ms:update_ixia_fixture
Nov 24, 2020
Merged

Update ixia_fixture to fix collection errors#2570
bingwang-ms merged 2 commits intosonic-net:masterfrom
bingwang-ms:update_ixia_fixture

Conversation

@bingwang-ms
Copy link
Collaborator

Signed-off-by: bingwang [email protected]

Description of PR

Summary:
Fixes # (issue)
Errors were reported during pytest collecting test cases because ImportError for IxNetworkApi, which is available only on ixia devices.

ImportError while importing test module '/var/sonicbld/workspace/NewTests/TEMPLATE_PYTEST_T0_A7260/tests/pfc/test_pfc_pause_lossless.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
pfc/test_pfc_pause_lossless.py:10: in <module>
    from tests.common.ixia.ixia_fixtures import ixia_api_serv_ip, \
common/ixia/ixia_fixtures.py:9: in <module>
    from ixnetwork_open_traffic_generator.ixnetworkapi import IxNetworkApi
E   ImportError: No module named ixnetwork_open_traffic_generator.ixnetworkapi

This commit attempts to catch import exception and skips cases when exception is caught.

Type of change

  • Bug fix
  • Testbed and Framework(new/improvement)
  • Test case(new/improvement)

Approach

What is the motivation for this PR?

This PR is to address pytest collection error caused by import exception.

How did you do it?

Add a logic to catch import exception, and skip cases if exception is caught.

How did you verify/test it?

Verified on Arista-7260 by running pytest collecting command.

pytest --inventory ../ansible/str,../ansible/veos --host-pattern str-7260cx3-acs-2 --testbed vms7-t0-7260-2 --testbed_file ../ansible/testbed.csv -m pretest --collect-only

SKIPPED [3] /data/Networking-acs-sonic-mgmt/tests/common/ixia/ixia_fixtures.py:13: Test case is skiped: ImportError('No module named ixnetwork_open_traffic_generator.ixnetworkapi',)
====================================================================== 3 skipped, 1209 deselected, 12 warnings in 47.55 seconds =======================================================================

We can see that 3 cases were skipped and no error was observed.

Any platform specific information?

No.

Supported testbed topology if it's a new test case?

No.

Documentation

No.

Errors were reported during pytest collecting test cases because
ImportError for IxNetworkApi, which is available only on ixia devices.
This commit attempts to catch import exception and skips cases when
exception is caught.

Signed-off-by: bingwang <[email protected]>
try:
from ixnetwork_open_traffic_generator.ixnetworkapi import IxNetworkApi
except ImportError as e:
raise pytest.skip.Exception("Test case is skiped: " + repr(e), allow_module_level=True)
Copy link
Contributor

Choose a reason for hiding this comment

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

'skipped'

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Thanks. Updated

Signed-off-by: bingwang <[email protected]>
@bingwang-ms bingwang-ms merged commit d2b231d into sonic-net:master Nov 24, 2020
kazinator-arista pushed a commit to kazinator-arista/sonic-mgmt that referenced this pull request Mar 4, 2026
Update sonic-utilities submodule pointer to include the following:

3bc2bc6 [Mellanox][202205] Change severity to NOTICE in Mellanox buffer migrator when unable to fetch DEVICE_METADATA due to empty CONFIG_DB during initialization (sonic-net#2570)
e1c8243 [202205][generate_dump] Fix for a deletion flow for all secret files in the techsupport dump (sonic-net#2572)
9f2984a [202205] Fix issue: unconfigured PGs are displayed in watermarkstat (sonic-net#2568)
f7988b0 [202205] [timer.unit.j2] use wanted-by in timer unit (sonic-net#2561)
f45dcfb [generate_dump] Optimize the execution time of 'show techsupport' CLI by paraller function execution (sonic-net#2565)
67cbb15 [202205]Fixes 12170: Delete subinterface and recreate the subinterface in default-vrf (sonic-net#2564)
93172c4 [202205] [generate_dump] Optimize the execution time of the 'show techsupport' script to 5-10% by reducing calls to the 'tar append' operation (sonic-net#2562)

Signed-off-by: dprital <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants