From 3c065ceded2a58d5aadbcf64417f2cfc92268a08 Mon Sep 17 00:00:00 2001 From: Eddy Pedroni Date: Wed, 26 Feb 2025 18:09:06 +0100 Subject: Refactor fixtures, introduce song pool argument --- .../test/solo_tool_integrationtest.py | 40 ++++------------------ 1 file changed, 7 insertions(+), 33 deletions(-) (limited to 'solo-tool-project/test/solo_tool_integrationtest.py') diff --git a/solo-tool-project/test/solo_tool_integrationtest.py b/solo-tool-project/test/solo_tool_integrationtest.py index f8ed2f1..5d8f14c 100644 --- a/solo-tool-project/test/solo_tool_integrationtest.py +++ b/solo-tool-project/test/solo_tool_integrationtest.py @@ -2,28 +2,7 @@ import pathlib import shutil import pytest -from solo_tool.solo_tool import SoloTool -from player_mock import Player as MockPlayer - -@pytest.fixture -def mockPlayer(): - return MockPlayer() - -@pytest.fixture -def uut(mockPlayer): - return SoloTool(mockPlayer) - -@pytest.fixture -def prepared_tmp_path(tmp_path): - testFiles = [ - "test.flac", - "test.mp3", - "test_session.json" - ] - for f in testFiles: - shutil.copy(pathlib.Path(f), tmp_path) - - return tmp_path +from fixtures import soloTool as uut, songPool, mockPlayer, testSongs def test_playerControls(uut, mockPlayer): assert not mockPlayer.playing @@ -104,9 +83,8 @@ def test_sanitizePlaybackVolume(uut): uut.volume = 150.0 assert uut.volume == 150.0 -def test_playingStateNotification(uut, mockPlayer): - song = "test.flac" - uut.addSong(song) +def test_playingStateNotification(uut, mockPlayer, testSongs): + uut.addSong(testSongs[0]) called = False receivedValue = None @@ -134,10 +112,8 @@ def test_playingStateNotification(uut, mockPlayer): uut.pause() assert not called -def test_playbackVolumeNotification(uut, mockPlayer): - song = "test.flac" - uut.addSong(song) - uut.song = 0 +def test_playbackVolumeNotification(uut, mockPlayer, testSongs): + uut.addSong(testSongs[0]) called = False receivedValue = None @@ -158,10 +134,8 @@ def test_playbackVolumeNotification(uut, mockPlayer): uut.volume = 0.3 assert not called -def test_playbackRateNotification(uut, mockPlayer): - song = "test.flac" - uut.addSong(song) - uut.song = 0 +def test_playbackRateNotification(uut, mockPlayer, testSongs): + uut.addSong(testSongs[0]) called = False receivedValue = None -- cgit v1.2.3