diff --git a/tests/__init__.py b/tests/arp/arp_args/__init__.py similarity index 100% rename from tests/__init__.py rename to tests/arp/arp_args/__init__.py diff --git a/tests/arp/args/wr_arp_args.py b/tests/arp/arp_args/wr_arp_args.py similarity index 100% rename from tests/arp/args/wr_arp_args.py rename to tests/arp/arp_args/wr_arp_args.py diff --git a/tests/arp/conftest.py b/tests/arp/conftest.py index 71ea65eeaa4..95bb9b21dd6 100644 --- a/tests/arp/conftest.py +++ b/tests/arp/conftest.py @@ -1,4 +1,4 @@ -from .args.wr_arp_args import add_wr_arp_args +from arp_args.wr_arp_args import add_wr_arp_args # WR-ARP pytest arguments def pytest_addoption(parser): diff --git a/tests/common/plugins/sanity_check/__init__.py b/tests/common/plugins/sanity_check/__init__.py index c290416f927..33354715fa5 100644 --- a/tests/common/plugins/sanity_check/__init__.py +++ b/tests/common/plugins/sanity_check/__init__.py @@ -13,6 +13,14 @@ logger = logging.getLogger(__name__) +def pytest_addoption(parser): + """Describe plugin specified options""" + parser.addoption("--skip_sanity", action="store_true", default=False, + help="Skip sanity check") + parser.addoption("--allow_recover", action="store_true", default=False, + help="Allow recovery attempt in sanity check in case of failure") + + def _update_check_items(old_items, new_items, supported_items): """ @summary: Update the items to be performed in sanity check diff --git a/tests/conftest.py b/tests/conftest.py index 66d6b7a6a7b..9d17bf9faf4 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -1,9 +1,3 @@ -# Adding pytest base dir to Python system path. -# This is required in order to import from common package including pytest_plugins within this file. -import site -from os.path import dirname, abspath -site.addsitedir(dirname(abspath(__file__))) - import sys import os import glob @@ -92,10 +86,10 @@ def pytest_addoption(parser): # test_vrf options parser.addoption("--vrf_capacity", action="store", default=None, type=int, help="vrf capacity of dut (4-1000)") parser.addoption("--vrf_test_count", action="store", default=None, type=int, help="number of vrf to be tested (1-997)") - ############################ # test_techsupport options # ############################ + parser.addoption("--loop_num", action="store", default=10, type=int, help="Change default loop range for show techsupport command") parser.addoption("--loop_delay", action="store", default=10, type=int, @@ -103,14 +97,6 @@ def pytest_addoption(parser): parser.addoption("--logs_since", action="store", type=int, help="number of minutes for show techsupport command") - ############################ - # sanity_check options # - ############################ - parser.addoption("--skip_sanity", action="store_true", default=False, - help="Skip sanity check") - parser.addoption("--allow_recover", action="store_true", default=False, - help="Allow recovery attempt in sanity check in case of failure") - @pytest.fixture(scope="session", autouse=True) def enhance_inventory(request): diff --git a/tests/platform/args/__init__.py b/tests/platform/args/__init__.py deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/platform/conftest.py b/tests/platform/conftest.py index b24a6d32517..04039b99835 100644 --- a/tests/platform/conftest.py +++ b/tests/platform/conftest.py @@ -1,6 +1,6 @@ import pytest from common.fixtures.advanced_reboot import get_advanced_reboot -from .args.advanced_reboot_args import add_advanced_reboot_args +from platform_args.advanced_reboot_args import add_advanced_reboot_args @pytest.fixture(autouse=True, scope="module") def skip_on_simx(duthost): diff --git a/tests/platform/mellanox/__init__.py b/tests/platform/mellanox/__init__.py deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/platform/mellanox/mellanox_thermal_control_test_helper.py b/tests/platform/mellanox/mellanox_thermal_control_test_helper.py index eff938be694..212453f3dc0 100644 --- a/tests/platform/mellanox/mellanox_thermal_control_test_helper.py +++ b/tests/platform/mellanox/mellanox_thermal_control_test_helper.py @@ -1,7 +1,7 @@ import os import random import logging -from ..thermal_control_test_helper import * +from thermal_control_test_helper import * from common.mellanox_data import SWITCH_MODELS from minimum_table import MINIMUM_TABLE diff --git a/tests/platform/mellanox/test_thermal_control.py b/tests/platform/mellanox/test_thermal_control.py index db567bfd43f..4eabad130be 100644 --- a/tests/platform/mellanox/test_thermal_control.py +++ b/tests/platform/mellanox/test_thermal_control.py @@ -6,7 +6,7 @@ from common.mellanox_data import SWITCH_MODELS from common.plugins.loganalyzer.loganalyzer import LogAnalyzer from common.utilities import wait_until -from ..thermal_control_test_helper import * +from thermal_control_test_helper import * from mellanox_thermal_control_test_helper import MockerHelper, AbnormalFanMocker THERMAL_CONTROL_TEST_WAIT_TIME = 65 diff --git a/tests/arp/args/__init__.py b/tests/platform/platform_args/__init__.py similarity index 100% rename from tests/arp/args/__init__.py rename to tests/platform/platform_args/__init__.py diff --git a/tests/platform/args/advanced_reboot_args.py b/tests/platform/platform_args/advanced_reboot_args.py similarity index 100% rename from tests/platform/args/advanced_reboot_args.py rename to tests/platform/platform_args/advanced_reboot_args.py diff --git a/tests/testbed_setup/__init__.py b/tests/testbed_setup/__init__.py deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/testbed_setup/args/__init__.py b/tests/testbed_setup/args/__init__.py deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/testbed_setup/conftest.py b/tests/testbed_setup/conftest.py index f0af95e8049..a9cd374667d 100644 --- a/tests/testbed_setup/conftest.py +++ b/tests/testbed_setup/conftest.py @@ -1,4 +1,4 @@ -from .args.populate_fdb_args import add_populate_fdb_args +from setup_args.populate_fdb_args import add_populate_fdb_args from common.fixtures.populate_fdb import populate_fdb # FDB pytest arguments diff --git a/tests/platform/__init__.py b/tests/testbed_setup/setup_args/__init__.py similarity index 100% rename from tests/platform/__init__.py rename to tests/testbed_setup/setup_args/__init__.py diff --git a/tests/testbed_setup/args/populate_fdb_args.py b/tests/testbed_setup/setup_args/populate_fdb_args.py similarity index 100% rename from tests/testbed_setup/args/populate_fdb_args.py rename to tests/testbed_setup/setup_args/populate_fdb_args.py