From bac8b9bf7c51008ceab75e83ce68fa9473a7d2ec Mon Sep 17 00:00:00 2001 From: Ying Xie Date: Thu, 5 Aug 2021 16:24:20 -0700 Subject: [PATCH] [sfp test option] move option --skip-absent-sfp definition to conftest.py (#3973) What is the motivation for this PR? Nightly test will fail if option --skip-absent-sfp is used when no target test script is specified. Which is usually how we run the nightly tests. How did you do it? Move the option definition to conftest.py How did you verify/test it? Kick off a nightly test with the change. Signed-off-by: Ying Xie ying.xie@microsoft.com --- tests/conftest.py | 10 ++++++++++ tests/platform_tests/args/api_sfp_args.py | 15 --------------- tests/platform_tests/conftest.py | 2 -- 3 files changed, 10 insertions(+), 17 deletions(-) delete mode 100644 tests/platform_tests/args/api_sfp_args.py diff --git a/tests/conftest.py b/tests/conftest.py index 43e05d14f87..dfef588440c 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -120,6 +120,16 @@ def pytest_addoption(parser): ############################ parser.addoption("--testnum", action="store", default=None, type=str) + ############################ + # platform sfp api options # + ############################ + + # Allow user to skip the absent sfp modules. User can use it like below: + # "--skip-absent-sfp=True" + # If this option is not specified, False will be used by default. + parser.addoption("--skip-absent-sfp", action="store", type=bool, default=False, + help="Skip test on absent SFP", + ) @pytest.fixture(scope="session", autouse=True) def enhance_inventory(request): diff --git a/tests/platform_tests/args/api_sfp_args.py b/tests/platform_tests/args/api_sfp_args.py deleted file mode 100644 index 2a0a7da228d..00000000000 --- a/tests/platform_tests/args/api_sfp_args.py +++ /dev/null @@ -1,15 +0,0 @@ -def add_api_sfp_args(parser): - ############################ - # platform sfp api options # - ############################ - - # Allow user to skip the absent sfp modules. User can use it like below: - # "--skip-absent-sfp=True" - # If this option is not specified, False will be used by default. - parser.addoption( - "--skip-absent-sfp", - action="store", - type=bool, - default=False, - help="Skip test on absent SFP", - ) diff --git a/tests/platform_tests/conftest.py b/tests/platform_tests/conftest.py index e622a9d03ba..8ef4c20a75e 100644 --- a/tests/platform_tests/conftest.py +++ b/tests/platform_tests/conftest.py @@ -14,7 +14,6 @@ from .args.advanced_reboot_args import add_advanced_reboot_args from .args.cont_warm_reboot_args import add_cont_warm_reboot_args from .args.normal_reboot_args import add_normal_reboot_args -from .args.api_sfp_args import add_api_sfp_args TEMPLATES_DIR = os.path.join(os.path.dirname(os.path.realpath(__file__)), "templates") FMT = "%b %d %H:%M:%S.%f" @@ -339,7 +338,6 @@ def pytest_addoption(parser): add_advanced_reboot_args(parser) add_cont_warm_reboot_args(parser) add_normal_reboot_args(parser) - add_api_sfp_args(parser) def pytest_generate_tests(metafunc):