diff --git a/test/plugins/test_art.py b/test/plugins/test_art.py index 30f08d50f0..c630c0780f 100644 --- a/test/plugins/test_art.py +++ b/test/plugins/test_art.py @@ -33,7 +33,7 @@ logger = logging.getLogger("beets.test_art") - + class Settings: """Used to pass settings to the ArtSources when the plugin isn't fully instantiated. @@ -1019,6 +1019,21 @@ def test_percent(self): def suite(): return unittest.TestLoader().loadTestsFromName(__name__) +def cleanup_tmp_files(): + # List all files and directories in /tmp that start with 'tmp' + temp_files = [f for f in os.listdir('/tmp') if f.startswith('tmp')] + + # Remove each file or directory + for f in temp_files: + temp_path = os.path.join('/tmp', f) + if os.path.isdir(temp_path): + shutil.rmtree(temp_path) + else: + os.remove(temp_path) + if __name__ == "__main__": unittest.main(defaultTest="suite") + + # Cleanup temporary files + cleanup_tmp_files() diff --git a/test/plugins/test_bareasc.py b/test/plugins/test_bareasc.py index 66d8495e56..5ea815969a 100644 --- a/test/plugins/test_bareasc.py +++ b/test/plugins/test_bareasc.py @@ -3,6 +3,8 @@ """Tests for the 'bareasc' plugin.""" +import os +import shutil import unittest from beets import logging @@ -87,6 +89,21 @@ def suite(): """loader.""" return unittest.TestLoader().loadTestsFromName(__name__) +def cleanup_tmp_files(): + # List all files and directories in /tmp that start with 'tmp' + temp_files = [f for f in os.listdir('/tmp') if f.startswith('tmp')] + + # Remove each file or directory + for f in temp_files: + temp_path = os.path.join('/tmp', f) + if os.path.isdir(temp_path): + shutil.rmtree(temp_path) + else: + os.remove(temp_path) + if __name__ == "__main__": unittest.main(defaultTest="suite") + + # Cleanup temporary files + cleanup_tmp_files() diff --git a/test/plugins/test_embedart.py b/test/plugins/test_embedart.py index 80d284d317..2b24fa7c0e 100644 --- a/test/plugins/test_embedart.py +++ b/test/plugins/test_embedart.py @@ -14,6 +14,7 @@ import os.path +import os import shutil import tempfile import unittest @@ -350,6 +351,21 @@ def test_convert_failure(self, mock_extract, mock_subprocess): def suite(): return unittest.TestLoader().loadTestsFromName(__name__) +def cleanup_tmp_files(): + # List all files and directories in /tmp that start with 'tmp' + temp_files = [f for f in os.listdir('/tmp') if f.startswith('tmp')] + + # Remove each file or directory + for f in temp_files: + temp_path = os.path.join('/tmp', f) + if os.path.isdir(temp_path): + shutil.rmtree(temp_path) + else: + os.remove(temp_path) + if __name__ == "__main__": unittest.main(defaultTest="suite") + + # Cleanup temporary files + cleanup_tmp_files() diff --git a/test/plugins/test_play.py b/test/plugins/test_play.py index cb99f6b433..975e148ccc 100644 --- a/test/plugins/test_play.py +++ b/test/plugins/test_play.py @@ -16,6 +16,7 @@ import os +import shutil import sys import unittest from unittest.mock import ANY, patch @@ -147,6 +148,22 @@ def test_command_failed(self, open_mock): def suite(): return unittest.TestLoader().loadTestsFromName(__name__) +def cleanup_tmp_files(): + # List all files and directories in /tmp that start with 'tmp' + temp_files = [f for f in os.listdir('/tmp') if f.startswith('tmp')] + + # Remove each file or directory + for f in temp_files: + temp_path = os.path.join('/tmp', f) + if os.path.isdir(temp_path): + shutil.rmtree(temp_path) + else: + os.remove(temp_path) + if __name__ == "__main__": unittest.main(defaultTest="suite") + + # Cleanup temporary files + cleanup_tmp_files() + diff --git a/test/plugins/test_zero.py b/test/plugins/test_zero.py index 378e419d50..3ed605e28e 100644 --- a/test/plugins/test_zero.py +++ b/test/plugins/test_zero.py @@ -1,5 +1,7 @@ """Tests for the 'zero' plugin""" +import os +import shutil import unittest from mediafile import MediaFile @@ -297,6 +299,22 @@ def test_empty_query_n_response_no_changes(self): def suite(): return unittest.TestLoader().loadTestsFromName(__name__) +def cleanup_tmp_files(): + # List all files and directories in /tmp that start with 'tmp' + temp_files = [f for f in os.listdir('/tmp') if f.startswith('tmp')] + + # Remove each file or directory + for f in temp_files: + temp_path = os.path.join('/tmp', f) + if os.path.isdir(temp_path): + shutil.rmtree(temp_path) + else: + os.remove(temp_path) + if __name__ == "__main__": unittest.main(defaultTest="suite") + + # Cleanup temporary files + cleanup_tmp_files() +