Commit fa116b2
Catch import error for sai_qualify (#21580)
sai_qualify is skipped in conditional mark file, but pytest still needs to load this file, but it fails to import apscheduler.
We have to catch this import error to avoid collection failure for pytest.
_________________ ERROR collecting sai_qualify/test_brcm_t0.py _________________
ImportError while importing test module '/var/src/sonic-mgmt_testbed-bjw2-can-t1-7260-11/tests/sai_qualify/test_brcm_t0.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
/usr/lib/python3.8/importlib/__init__.py:127: in import_module
return _bootstrap._gcd_import(name[level:], package, level)
sai_qualify/test_brcm_t0.py:7: in <module>
from .sai_infra import run_case_from_ptf, store_test_result
sai_qualify/sai_infra.py:17: in <module>
from apscheduler.schedulers.background import BackgroundScheduler
E ModuleNotFoundError: No module named 'apscheduler'
What is the motivation for this PR?
Fix No module named 'apscheduler'
How did you do it?
Catch ImportError to avoid pytest collection failure.
How did you verify/test it?
Run it, it's skipped successfully, not failed anymore.
collected 5 items
sai_qualify/test_sai_ptf_warm_reboot.py::test_sai[None-sainexthopgroup.L3IPv4EcmpHostTwoLagsTest] SKIPPED (It is not tested for now) [ 20%]
sai_qualify/test_sai_ptf_warm_reboot.py::test_sai[None-sainexthopgroup.L3IPv4EcmpHostPortLagSharedMembersTest] SKIPPED (It is not tested for now) [ 40%]
sai_qualify/test_sai_ptf_warm_reboot.py::test_sai[None-sairif.RifToSubPortTest] SKIPPED (It is not tested for now) [ 60%]
sai_qualify/test_sai_ptf_warm_reboot.py::test_sai[None-sairif.SviHostTest] SKIPPED (It is not tested for now) [ 80%]
sai_qualify/test_sai_ptf_warm_reboot.py::test_sai[None-sairif.SviLagHostTest] SKIPPED (It is not tested for now) [100%]
--------------------------------------------------------------------------------------------------------------------------------- live log teardown ---------------------------------------------------------------------------------------------------------------------------------
05
Signed-off-by: Zhaohui Sun <zhaohuisun@microsoft.com>
Signed-off-by: selldinesh <dinesh.sellappan@keysight.com>1 parent ff11acc commit fa116b2
1 file changed
Lines changed: 11 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
17 | | - | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
18 | 24 | | |
19 | 25 | | |
20 | 26 | | |
| |||
96 | 102 | | |
97 | 103 | | |
98 | 104 | | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
99 | 109 | | |
100 | 110 | | |
101 | 111 | | |
| |||
0 commit comments