diff options
Diffstat (limited to 'solo-tool-project/test')
7 files changed, 19 insertions, 34 deletions
| diff --git a/solo-tool-project/test/fixtures.py b/solo-tool-project/test/fixtures.py index 3306388..1f2299f 100644 --- a/solo-tool-project/test/fixtures.py +++ b/solo-tool-project/test/fixtures.py @@ -10,12 +10,6 @@ def mockPlayer():      return MockPlayer()  @pytest.fixture -def songPool(tmp_path): -    path = tmp_path / "songs" -    os.mkdir(path) -    return path - -@pytest.fixture  def sessionPath(tmp_path):      path = tmp_path / "sessions"      os.mkdir(path) @@ -26,11 +20,13 @@ def soloTool(mockPlayer):      return SoloTool(player=mockPlayer)  @pytest.fixture -def testSongs(songPool): +def testSongs(tmp_path): +    path = tmp_path / "songs" +    os.mkdir(path)      songs = [ -        songPool / "test.flac", -        songPool / "test.mp3", -        songPool / "test.mp4" +        path / "test.flac", +        path / "test.mp3", +        path / "test.mp4"      ]      for song in songs: diff --git a/solo-tool-project/test/handlers_integrationtest.py b/solo-tool-project/test/handlers_integrationtest.py index 85050d6..6696f86 100644 --- a/solo-tool-project/test/handlers_integrationtest.py +++ b/solo-tool-project/test/handlers_integrationtest.py @@ -1,6 +1,6 @@  import pytest -from fixtures import soloTool, testSongs, mockPlayer, songPool +from fixtures import soloTool, testSongs, mockPlayer  from solo_tool.handlers import keyPointRelative diff --git a/solo-tool-project/test/midi_launchpad_mini_integrationtest.py b/solo-tool-project/test/midi_launchpad_mini_integrationtest.py index be8ed88..1a99cd4 100644 --- a/solo-tool-project/test/midi_launchpad_mini_integrationtest.py +++ b/solo-tool-project/test/midi_launchpad_mini_integrationtest.py @@ -2,7 +2,7 @@ import pytest  from mido import Message  from solo_tool.midi_controller_launchpad_mini import MidiController -from fixtures import songPool, soloTool, mockPlayer, testSongs +from fixtures import soloTool, mockPlayer, testSongs  LED_RED = 3  LED_YELLOW = 126 diff --git a/solo-tool-project/test/session_manager_unittest.py b/solo-tool-project/test/session_manager_unittest.py index bb40fdf..690bec0 100644 --- a/solo-tool-project/test/session_manager_unittest.py +++ b/solo-tool-project/test/session_manager_unittest.py @@ -3,7 +3,7 @@ from json import loads  import os  from solo_tool.session_manager import getSessionManager, _FileSystemSessionManager, _FileBrowserSessionManager -from fixtures import songPool, soloTool, mockPlayer, testSongs, sessionPath +from fixtures import soloTool, mockPlayer, testSongs, sessionPath  @pytest.fixture  def testSessionFile(sessionPath, testSongs): @@ -23,8 +23,8 @@ def testSessionFile(sessionPath, testSongs):      return sessionFile  @pytest.fixture -def sessionManager(sessionPath, songPool): -    return getSessionManager(str(songPool), str(sessionPath)) +def sessionManager(sessionPath): +    return getSessionManager(str(sessionPath))  def test_loadSession(sessionManager, mockPlayer, testSessionFile):      sessions = sessionManager.getSessions() @@ -64,20 +64,9 @@ def test_loadAndSaveEmptySession(sessionManager, sessionPath, soloTool, tmp_path      assert reloadedTool.songs == [] -def test_uploadSong(sessionManager, songPool, tmp_path): -    song = tmp_path / "song-to-be-uploaded.mp3" -    song.touch() -     -    expected = songPool / "song-to-be-uploaded.mp3" -    assert not expected.exists() - -    with open(song, "rb") as f: -        sessionManager.addSong("song-to-be-uploaded.mp3", f) -    assert expected.exists() -  def test_sessionManagerFactory(): -    assert type(getSessionManager("", "/some_absolute_dir")) is _FileSystemSessionManager -    assert type(getSessionManager("", "file:///some_dir_with_protocol")) is _FileSystemSessionManager -    assert type(getSessionManager("", "some_relative_dir")) is _FileSystemSessionManager -    assert type(getSessionManager("", "http://some_server")) is _FileBrowserSessionManager -    assert type(getSessionManager("", "https://some_secure_server")) is _FileBrowserSessionManager +    assert type(getSessionManager("/some_absolute_dir")) is _FileSystemSessionManager +    assert type(getSessionManager("file:///some_dir_with_protocol")) is _FileSystemSessionManager +    assert type(getSessionManager("some_relative_dir")) is _FileSystemSessionManager +    assert type(getSessionManager("http://some_server")) is _FileBrowserSessionManager +    assert type(getSessionManager("https://some_secure_server")) is _FileBrowserSessionManager diff --git a/solo-tool-project/test/solo_tool_integrationtest.py b/solo-tool-project/test/solo_tool_integrationtest.py index 7b274a3..b92cd85 100644 --- a/solo-tool-project/test/solo_tool_integrationtest.py +++ b/solo-tool-project/test/solo_tool_integrationtest.py @@ -1,4 +1,4 @@ -from fixtures import soloTool as uut, songPool, mockPlayer, testSongs +from fixtures import soloTool as uut, mockPlayer, testSongs  def test_playerControls(uut, mockPlayer):      assert not mockPlayer.playing diff --git a/solo-tool-project/test/solo_tool_keypoints_integrationtest.py b/solo-tool-project/test/solo_tool_keypoints_integrationtest.py index 3db86f5..f79103d 100644 --- a/solo-tool-project/test/solo_tool_keypoints_integrationtest.py +++ b/solo-tool-project/test/solo_tool_keypoints_integrationtest.py @@ -1,6 +1,6 @@  import pytest -from fixtures import soloTool as uut, songPool, mockPlayer, testSongs +from fixtures import soloTool as uut, mockPlayer, testSongs  def test_keyPointAndSongSelection(uut, mockPlayer, testSongs):      def checkJump(before, expectedAfter): diff --git a/solo-tool-project/test/solo_tool_songs_integrationtest.py b/solo-tool-project/test/solo_tool_songs_integrationtest.py index 0acfc2b..caa4a30 100644 --- a/solo-tool-project/test/solo_tool_songs_integrationtest.py +++ b/solo-tool-project/test/solo_tool_songs_integrationtest.py @@ -1,6 +1,6 @@  import pytest -from fixtures import soloTool as uut, songPool, mockPlayer, testSongs +from fixtures import soloTool as uut, mockPlayer, testSongs  def test_songSelectionFlow(uut, mockPlayer, testSongs):      # Initially, song list is empty and no song is selected | 
