Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 0 additions & 18 deletions ovoscope/media.py
Original file line number Diff line number Diff line change
Expand Up @@ -340,30 +340,12 @@ def __enter__(self) -> "OCPPlayerHarness":
gui_mock = MagicMock()
self.gui = gui_mock

# Patch Playlist so that Playlist("Search Results") doesn't try to
# add the string as a media entry. The installed ovos_utils.ocp.Playlist
# treats all positional args as entries; we need a subclass that silently
# drops bare string args (which are titles, not entries) and still
# satisfies isinstance(x, Playlist) checks inside player.py.
from ovos_utils.ocp import Playlist as _RealPlaylist

class _TolerantPlaylist(_RealPlaylist):
"""Playlist subclass that ignores bare string constructor args."""

def __init__(self, *args, **kwargs):
valid = [a for a in args if not isinstance(a, str)]
super().__init__(*valid, **kwargs)

# Every mock.patch below is process-wide until stopped. If anything
# after the first start() raises (a missing ovos_media attribute, a
# backend constructor error), an unguarded exit would leave those
# patches active for the rest of the process and silently corrupt
# every later test. Unwind through __exit__ before propagating.
try:
p_playlist = patch("ovos_media.player.Playlist", _TolerantPlaylist)
p_playlist.start()
self._patches.append(p_playlist)

simple_targets = [
"ovos_media.player.AudioService",
"ovos_media.player.VideoService",
Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ pydantic = ["ovos-pydantic-models>=0.1.0"]
# ovos-spec-tools 0.10.0a1, so that is the real floor.
audio = ["ovos-audio>=1.3.0a1", "ovos-spec-tools>=0.10.0a1"]
# OCP / ovos-media player harnesses (ovoscope.media: OCPPlayerHarness, ...).
media = ["ovos-media>=0.0.2a3"]
media = ["ovos-media>=0.4.3a1"]
# MiniListener plugin_instances path (feed_audio_stream) needs the dinkum
# AudioTransformersService. >=0.7.2a1 is the first release that allows
# ovos-bus-client 2.x (older pins cap it <2.0.0 and conflict with ovos-core).
Expand All @@ -64,7 +64,7 @@ tts = [
]
dev = [
"ovos-audio>=1.3.0a1",
"ovos-media>=0.0.2a3",
"ovos-media>=0.4.3a1",
"ovos-dinkum-listener>=0.7.2a1",
"ovos-pydantic-models>=0.1.0",
"numpy",
Expand Down
Loading