From 73b410aa97b0717b77b40c9204cfe81c3c776cb6 Mon Sep 17 00:00:00 2001 From: Goffi Date: Thu, 9 Apr 2026 21:33:47 +0200 Subject: [PATCH] tests (unit/cli/calls): Skip tests in case of missing `media` or `webrtc`: Test were raising exceptions when optional modules were missing (GStreamer related modules for `webrtc`). Those are now catched so the tests are simply skipped in this case. `MissingModule` is now inheriting from `ImportError`, as it's a natural subclass, and it makes import error catching easier. --- libervia/backend/core/exceptions.py | 2 +- tests/unit/cli/test_calls.py | 9 +++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/libervia/backend/core/exceptions.py b/libervia/backend/core/exceptions.py index 27126069..e48b8d48 100644 --- a/libervia/backend/core/exceptions.py +++ b/libervia/backend/core/exceptions.py @@ -54,7 +54,7 @@ class UnknownGroupError(Exception): pass -class MissingModule(Exception): +class MissingModule(ImportError): # Used to indicate when a plugin dependence is not found # it's nice to indicate when to find the dependence in argument string pass diff --git a/tests/unit/cli/test_calls.py b/tests/unit/cli/test_calls.py index f25881d3..6190213d 100644 --- a/tests/unit/cli/test_calls.py +++ b/tests/unit/cli/test_calls.py @@ -20,11 +20,16 @@ from unittest.mock import MagicMock, patch import pytest try: + from libervia import media + import webrtc from libervia.cli.call_gui import AVCallUI from libervia.frontends.tools import display_servers from PyQt6.QtWidgets import QApplication -except ModuleNotFoundError: - pytest.skip("PyQt6 is not available.", allow_module_level=True) +except ImportError as e: + pytest.skip( + f"Required dependencies not available ({type(e).__name__}: {e}).", + allow_module_level=True, + ) @pytest.fixture(scope="session")