From d28a1b91afa86b6e39ac4df24d8bada7e795b20b Mon Sep 17 00:00:00 2001 From: Eddy Pedroni Date: Sat, 1 Jan 2022 17:00:15 +0100 Subject: Improved tmp_path usage in solo tool tests --- solo_tool_integrationtest.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'solo_tool_integrationtest.py') diff --git a/solo_tool_integrationtest.py b/solo_tool_integrationtest.py index b9ce62e..d0123d5 100644 --- a/solo_tool_integrationtest.py +++ b/solo_tool_integrationtest.py @@ -13,8 +13,8 @@ def mockPlayer(): def uut(mockPlayer): return SoloTool(mockPlayer) -@pytest.fixture(autouse=True) -def copyTestFiles(tmp_path): +@pytest.fixture +def prepared_tmp_path(tmp_path): testFiles = [ "test.flac", "test.mp3", @@ -23,6 +23,8 @@ def copyTestFiles(tmp_path): for f in testFiles: shutil.copy(pathlib.Path(f), tmp_path) + return tmp_path + def test_playerControls(uut, mockPlayer): assert mockPlayer.state == MockPlayer.STOPPED assert uut.isPlaying() == False @@ -204,12 +206,12 @@ def test_storeAbLimitsWithoutSong(uut, mockPlayer): uut.tick() assert mockPlayer.position == abLimit[0] -def test_loadAndSaveSession(tmp_path): +def test_loadAndSaveSession(prepared_tmp_path): mockPlayer = MockPlayer() uut = SoloTool(mockPlayer) - loadedSessionFile = tmp_path / "test_session.json" - savedSessionFile = tmp_path / "test_session_save.json" + loadedSessionFile = prepared_tmp_path / "test_session.json" + savedSessionFile = prepared_tmp_path / "test_session_save.json" uut.loadSession(loadedSessionFile) uut.saveSession(savedSessionFile) -- cgit v1.2.3