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.
This commit is contained in:
Goffi 2026-04-09 21:33:47 +02:00
commit 73b410aa97
2 changed files with 8 additions and 3 deletions

View file

@ -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

View file

@ -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")