Skip to content

Commit

Permalink
[sfp test option] move option --skip-absent-sfp definition to conftes…
Browse files Browse the repository at this point in the history
…t.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 [email protected]
  • Loading branch information
yxieca authored Aug 5, 2021
1 parent 5074a3a commit bac8b9b
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 17 deletions.
10 changes: 10 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
15 changes: 0 additions & 15 deletions tests/platform_tests/args/api_sfp_args.py

This file was deleted.

2 changes: 0 additions & 2 deletions tests/platform_tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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):
Expand Down

0 comments on commit bac8b9b

Please sign in to comment.