Source code for tests.utils.common_utils

#
# SPDX-FileCopyrightText: <text>Copyright 2026 Arm Limited and/or its
# affiliates <open-source-office@arm.com></text>
#
# SPDX-License-Identifier: MIT

from __future__ import annotations

import logging
from typing import Iterable

import pytest

LOG_FORMAT = "%(asctime)s %(levelname)s %(name)s:%(lineno)d: %(message)s"

logging.basicConfig(level=logging.INFO, format=LOG_FORMAT)


[docs] class CommonUtils: """Common utilities for test automation.""" @staticmethod
[docs] def get_logger(name: str) -> logging.Logger: """Return a logger configured with the common format. :param name: Name of the logger (usually __name__) :return: Configured logger instance """ return logging.getLogger(name)
@staticmethod
[docs] def require_supported_platform( platform_name: str, platform_base_obj, supported_platforms: Iterable[str], suite_name: str, ) -> None: """Skip the test if the platform is not in the supported list. :param platform_name: Name of the platform being tested :param platform_base_obj: Base object for the platform :param supported_platforms: Iterable of supported platform names :param suite_name: Name of the test suite for logging """ if platform_name not in set(supported_platforms): pytest.skip( f"{suite_name} is not enabled for platform: " f"{platform_base_obj.platform}" )
__all__ = ["CommonUtils"]