-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
this will ensure fixatures through out the test.
- Loading branch information
1 parent
2ab97a8
commit 14bcb61
Showing
2 changed files
with
69 additions
and
75 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
import pytest | ||
import vlc | ||
from pathlib import Path | ||
from ethos.player import MusicPlayer | ||
|
||
# --- Dummy VLC Classes for Testing --- # | ||
|
||
class DummyMedia: | ||
def __init__(self, path): | ||
self.path = path | ||
self.duration = 10000 | ||
|
||
def get_duration(self): | ||
return self.duration | ||
|
||
class DummyPlayer: | ||
def __init__(self): | ||
self.volume = 50 | ||
self.time = 0 | ||
self.media = None | ||
|
||
def set_media(self, media): | ||
self.media = media | ||
|
||
def play(self): | ||
|
||
pass | ||
|
||
def pause(self): | ||
pass | ||
|
||
def stop(self): | ||
self.media = None | ||
|
||
def audio_set_volume(self, volume): | ||
self.volume = volume | ||
|
||
def audio_get_volume(self): | ||
return self.volume | ||
|
||
def get_state(self): | ||
return "DummyState" | ||
|
||
def get_time(self): | ||
return self.time | ||
|
||
def set_time(self, new_time): | ||
self.time = new_time | ||
|
||
def get_media(self): | ||
return self.media | ||
|
||
class DummyVLCInstance: | ||
def media_new(self, path): | ||
return DummyMedia(path) | ||
|
||
def media_player_new(self): | ||
return DummyPlayer() | ||
|
||
# --- Fixtures --- # | ||
|
||
@pytest.fixture | ||
def music_player(monkeypatch): | ||
""" | ||
Fixture that patches vlc.Instance to use DummyVLCInstance. | ||
""" | ||
monkeypatch.setattr(vlc, "Instance", lambda: DummyVLCInstance()) | ||
return MusicPlayer() | ||
|
This file was deleted.
Oops, something went wrong.