sonic-buildimage/platform/mellanox/mlnx-platform-api/tests/conftest.py

45 lines
1.5 KiB
Python
Raw Normal View History

#
[202311][Mellanox] Integrate HW-MGMT Version 7.0030.2008 (#17659) * Intgerate HW-MGMT 7.0030.2008 Changes ## Patch List * 0285-UBUNTU-SAUCE-mlxbf-gige-Fix-intermittent-no-ip-issue.patch : * 0286-pinctrl-Introduce-struct-pinfunction-and-PINCTRL_PIN.patch : * 0287-pinctrl-mlxbf3-Add-pinctrl-driver-support.patch : * 0288-UBUNTU-SAUCE-gpio-mmio-handle-ngpios-properly-in-bgp.patch : * 0289-UBUNTU-SAUCE-gpio-mlxbf3-Add-gpio-driver-support.patch : * 0291-mlxsw-core_hwmon-Align-modules-label-name-assignment.patch : * 0292-mlxsw-i2c-Limit-single-transaction-buffer-size.patch : * 0293-mlxsw-reg-Limit-MTBR-register-records-buffer-by-one-.patch : * 0296-UBUNTU-SAUCE-mmc-sdhci-of-dwcmshc-Add-runtime-PM-ope.patch : * 0298-UBUNTU-SAUCE-mlxbf-ptm-use-0444-instead-of-S_IRUGO.patch : * 0299-UBUNTU-SAUCE-mlxbf-ptm-add-atx-debugfs-nodes.patch : * 0300-UBUNTU-SAUCE-mlxbf-ptm-update-module-version.patch : * 0301-UBUNTU-SAUCE-mlxbf-gige-Fix-kernel-panic-at-shutdown.patch : * 0302-UBUNTU-SAUCE-mlxbf-bootctl-support-SMC-call-for-sett.patch : * 0303-UBUNTU-SAUCE-Add-BF3-related-ACPI-config-and-Ring-de.patch : * 0306-dt-bindings-trivial-devices-Add-infineon-xdpe1a2g7.patch : * 0307-leds-mlxreg-Add-support-for-new-flavour-of-capabilit.patch : * 0308-leds-mlxreg-Remove-code-for-amber-LED-colour.patch : * 0308-platform_data-mlxreg-Add-capability-bit-and-mask-fie.patch : * 0309-hwmon-mlxreg-fan-Add-support-for-new-flavour-of-capa.patch : * 0310-hwmon-mlxreg-fan-Extend-number-of-supporetd-fans.patch : * 0317-platform-mellanox-Introduce-support-for-switches-equ.patch : * 0318-mellanox-Relocate-mlx-platform-driver.patch : * 0319-UBUNTU-SAUCE-mlxbf-tmfifo-fix-potential-race.patch : * 0320-UBUNTU-SAUCE-mlxbf-tmfifo-Drop-the-Rx-packet-if-no-m.patch : * 0321-UBUNTU-SAUCE-mlxbf-tmfifo-Drop-jumbo-frames.patch : * 0322-UBUNTU-SAUCE-mlxbf-tmfifo.c-Amend-previous-tmfifo-pa.patch : * 0323-mlxbf_gige-add-set_link_ksettings-ethtool-callback.patch : * 0324-mlxbf_gige-fix-white-space-in-mlxbf_gige_eth_ioctl.patch : * 0325-UBUNTU-SAUCE-mlxbf-bootctl-Fix-kernel-panic-due-to-b.patch : * 0326-platform-mellanox-mlxreg-hotplug-Add-support-for-new.patch : * 0327-platform-mellanox-mlx-platform-Change-register-name.patch : * 0328-platform-mellanox-mlx-platform-Add-support-for-new-X.patch : * [Mellanox] Don't populate arm64 Kconfig when integrating hw-mgmt Signed-off-by: Vivek Reddy <vkarri@nvidia.com> * [Mellanox] Remove thermal zone related code and replace with new one * Revert "Revert "[Mellanox] Align PSU temperature sysfs node name with hw-management change (#16820)" (#16956)" This reverts commit c2edc6f9d5fd812d89873e47456ae6c38bc05dee. * Update copyright header Signed-off-by: Kebo Liu <kebol@nvidia.com> --------- Signed-off-by: Vivek Reddy <vkarri@nvidia.com> Signed-off-by: Kebo Liu <kebol@nvidia.com> Co-authored-by: Vivek Reddy <vkarri@nvidia.com> Co-authored-by: Junchao-Mellanox <junchao@nvidia.com> Co-authored-by: Junchao-Mellanox <57339448+Junchao-Mellanox@users.noreply.github.com>
2024-01-16 10:33:50 -06:00
# Copyright (c) 2021-2024 NVIDIA CORPORATION & AFFILIATES.
# Apache-2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
import os
import pytest
import sys
test_path = os.path.dirname(os.path.abspath(__file__))
modules_path = os.path.dirname(test_path)
sys.path.insert(0, modules_path)
os.environ["PLATFORM_API_UNIT_TESTING"] = "1"
from sonic_platform import utils
@pytest.fixture(scope='function', autouse=True)
def auto_recover_mock():
"""Auto used fixture to recover some critical mocked functions
"""
origin_os_path_exists = os.path.exists
origin_read_int_from_file = utils.read_int_from_file
origin_read_str_from_file = utils.read_str_from_file
origin_read_float_from_file = utils.read_float_from_file
origin_write_file = utils.write_file
yield
os.path.exists = origin_os_path_exists
utils.read_int_from_file = origin_read_int_from_file
utils.read_str_from_file = origin_read_str_from_file
utils.write_file = origin_write_file
utils.read_float_from_file = origin_read_float_from_file