diff --git a/tests/packages/mlx/conftest.py b/tests/packages/mlx/conftest.py index 4bb0f118a..5562a9a8d 100644 --- a/tests/packages/mlx/conftest.py +++ b/tests/packages/mlx/conftest.py @@ -23,3 +23,10 @@ def host_without_mlx_compat_loaded(host_with_saved_yum_state): if mlx_compat_loaded: logging.info("test is done so reload mlx_compat") host.ssh(['modprobe', '-v', 'mlx_compat']) + +@pytest.fixture(scope="package") +def host_without_mlx_card(host): + if host.ssh_with_result(["lspci", "|", "grep", "Mellanox"]).returncode == 0: + # Skip test to not mess with mellanox card + pytest.skip("This test can't be run on a host with a mellanox card") + yield host diff --git a/tests/packages/mlx/test_mellanox-modules-compat.py b/tests/packages/mlx/test_mellanox-modules-compat.py index 2604f0788..e6a67bef7 100644 --- a/tests/packages/mlx/test_mellanox-modules-compat.py +++ b/tests/packages/mlx/test_mellanox-modules-compat.py @@ -1,3 +1,5 @@ +import pytest + # Requirements: # From --hosts parameter: # - host(A1): any master host of a pool, with access to XCP-ng RPM repositories. @@ -8,6 +10,7 @@ def load_unload_mlx_module(host): host.ssh(['modprobe', '-v', MLX4_MODULE]) host.ssh(['modprobe', '-r', '-v', MLX4_MODULE]) +@pytest.mark.usefixtures("host_without_mlx_card") def test_install_mlx_modules_alt(host_without_mlx_compat_loaded): host = host_without_mlx_compat_loaded