Загрузка данных


    config.group_state = {
        "current_suite": None,
        "suite_start_time": None,
        "stand_manager": None,
        "imitator_start_time": None,  # datetime объект времени старта имитатора для расчёта интервалов утечек
        "use_lds_configurator": True,
        "resolved_tu_id": None,
        "admin_tu_name": None,
        "pre_run_running_tus": None,
        "suite_infra_ready": False,
        "suite_setup_failure": None,
    }








def require_suite_infra(request):
    """
    Пропускает тесты набора, если infra-setup не завершился успешно.
    """








    if cfg.get("current_suite") and not cfg.get("suite_infra_ready"):
        reason = cfg.get("suite_setup_failure") or "ошибка подготовки набора"
        pytest.skip(f"[SETUP] [ERROR] Инфраструктура набора не готова: {reason}")


def _skip_current_suite_after_setup_failure(cfg: dict, message: str) -> None:
    """
    Пропускает текущий набор после ошибки setup: cleanup частичной инфраструктуры и pytest.skip.
    """
    logger.error(message)
    try:
        allure.attach(message, name="Ошибка setup набора", attachment_type=allure.attachment_type.TEXT)
    except Exception:
        logger.debug("Не удалось прикрепить ошибку setup к Allure", exc_info=True)
    _run_lds_configurator_teardown_if_needed(cfg)
    if stand_manager := cfg.get("stand_manager"):
        try:
            stand_manager.stop_imitator_wrapper()
        except Exception:
            logger.exception("[SETUP] Ошибка остановки имитатора после неудачного setup набора")
    cfg["suite_infra_ready"] = False
    cfg["suite_setup_failure"] = message
    pytest.skip(message)








        # start new
        cfg["current_suite"] = current_test_suite
        cfg["suite_start_time"] = None
        cfg["suite_infra_ready"] = False
        cfg["suite_setup_failure"] = None






дальше все заменить
                pytest.exit(
                    f"[SETUP] [ERROR] Набор '{suite_config.suite_name}': admin_tu обязателен "
                    "при use_lds_configurator=True"
                )
            if suite_config.admin_tu is None:
                _skip_current_suite_after_setup_failure(
                    cfg,
                    f"[SETUP] [ERROR] Набор '{suite_config.suite_name}': admin_tu обязателен "
                    "при use_lds_configurator=True",
                )


            pytest.exit(msg)
            _skip_current_suite_after_setup_failure(cfg, msg)







            pytest.exit(f"[SETUP] [ERROR] ошибка при подготовке стенда: {error}")
            _skip_current_suite_after_setup_failure(
                cfg, f"[SETUP] [ERROR] ошибка при подготовке стенда: {error}"
            )










            pytest.exit(f"[SETUP] [ERROR] ошибка обновления id датчиков отбраковки из конфигурации: {error}")
            _skip_current_suite_after_setup_failure(
                cfg,
                f"[SETUP] [ERROR] ошибка обновления id датчиков отбраковки из конфигурации: {error}",
            )






                pytest.exit(f"[SETUP] [ERROR] LDS Configurator admin setup: {error}")
                _skip_current_suite_after_setup_failure(
                    cfg, f"[SETUP] [ERROR] LDS Configurator admin setup: {error}"
                )





            pytest.exit(f"[SETUP] [ERROR] ошибка запуска имитатора: {error}")
            _skip_current_suite_after_setup_failure(
                cfg, f"[SETUP] [ERROR] ошибка запуска имитатора: {error}"
            )




            pytest.exit(f"[SETUP] [ERROR] ошибка запуска СORE контейнеров: {error}")
            _skip_current_suite_after_setup_failure(
                cfg, f"[SETUP] [ERROR] ошибка запуска СORE контейнеров: {error}"
            )





                # Имитатор остановится в pytest_sessionfinish через stop_imitator_wrapper
                pytest.exit(f"[SETUP] [ERROR] LDS Configurator проверка после запуска ядра: {error}")
                _skip_current_suite_after_setup_failure(
                    cfg, f"[SETUP] [ERROR] LDS Configurator проверка после запуска ядра: {error}"
                )









            cfg["stand_manager"] = None
        cfg["current_suite"] = None
        cfg["suite_start_time"] = None
        cfg["imitator_start_time"] = None
        cfg["suite_infra_ready"] = False
        cfg["suite_setup_failure"] = None