From 206a02214e1c28e8f99ac2450620cd634f56a9d7 Mon Sep 17 00:00:00 2001 From: Keith Edmunds Date: Mon, 18 Aug 2025 13:11:35 +0100 Subject: [PATCH] All tests pass --- tests/test_ds.py | 5 ++--- tests/test_file_importer.py | 5 ++--- tests/test_misc.py | 5 ++--- tests/test_playlistmodel.py | 13 ++++++------- tests/test_queries.py | 5 ++--- tests/test_ui.py | 5 ++--- 6 files changed, 16 insertions(+), 22 deletions(-) diff --git a/tests/test_ds.py b/tests/test_ds.py index 7a0268b..371828a 100644 --- a/tests/test_ds.py +++ b/tests/test_ds.py @@ -8,7 +8,6 @@ import unittest # App imports from app import playlistmodel from app import ds -from dbmanager import db from classes import PlaylistDTO from helpers import get_all_track_metadata from playlistmodel import PlaylistModel @@ -35,7 +34,7 @@ class MyTestCase(unittest.TestCase): def setUp(self): """Runs before each test""" - db.create_all() + ds.db.create_all() def playlist_create_and_model( self, playlist_name: str @@ -91,7 +90,7 @@ class MyTestCase(unittest.TestCase): def tearDown(self): """Runs after each test""" - db.drop_all() + ds.db.drop_all() def test_add_track_to_header(self): """Add a track to a header row""" diff --git a/tests/test_file_importer.py b/tests/test_file_importer.py index b31b042..58e08c3 100644 --- a/tests/test_file_importer.py +++ b/tests/test_file_importer.py @@ -21,7 +21,6 @@ from pytestqt.plugin import QtBot # type: ignore # App imports from app import ds, musicmuster -from dbmanager import db from config import Config from file_importer import FileImporter @@ -46,7 +45,7 @@ class MyTestCase(unittest.TestCase): def setUpClass(cls): """Runs once before any test in this class""" - db.create_all() + ds.db.create_all() cls.widget = musicmuster.Window() @@ -65,7 +64,7 @@ class MyTestCase(unittest.TestCase): def tearDownClass(cls): """Runs once after all tests""" - db.drop_all() + ds.db.drop_all() shutil.rmtree(cls.musicstore) shutil.rmtree(cls.import_source) diff --git a/tests/test_misc.py b/tests/test_misc.py index 35c386c..e787669 100644 --- a/tests/test_misc.py +++ b/tests/test_misc.py @@ -7,16 +7,15 @@ import unittest import pytest # App imports -from dbmanager import db import ds class TestMMMisc(unittest.TestCase): def setUp(self): - db.create_all() + ds.db.create_all() def tearDown(self): - db.drop_all() + ds.db.drop_all() def test_log_exception(self): """Test deliberate exception""" diff --git a/tests/test_playlistmodel.py b/tests/test_playlistmodel.py index db6bd34..fc0c16e 100644 --- a/tests/test_playlistmodel.py +++ b/tests/test_playlistmodel.py @@ -9,7 +9,6 @@ from PyQt6.QtCore import Qt, QModelIndex # App imports from app.helpers import get_all_track_metadata from app import ds, playlistmodel -from dbmanager import db from classes import ( InsertTrack, TrackAndPlaylist, @@ -30,7 +29,7 @@ class TestMMMiscTracks(unittest.TestCase): "testdata/wrb.flac", ] - db.create_all() + ds.db.create_all() # Create a playlist and model self.playlist = ds.playlist_create(PLAYLIST_NAME, template_id=0) @@ -51,7 +50,7 @@ class TestMMMiscTracks(unittest.TestCase): ) def tearDown(self): - db.drop_all() + ds.db.drop_all() def test_8_row_playlist(self): # Test auto-created playlist @@ -98,10 +97,10 @@ class TestMMMiscNoPlaylist(unittest.TestCase): ] def setUp(self): - db.create_all() + ds.db.create_all() def tearDown(self): - db.drop_all() + ds.db.drop_all() def test_insert_track_new_playlist(self): # insert a track into a new playlist @@ -137,7 +136,7 @@ class TestMMMiscRowMove(unittest.TestCase): ROWS_TO_CREATE = 11 def setUp(self): - db.create_all() + ds.db.create_all() self.playlist = ds.playlist_create(self.PLAYLIST_NAME, template_id=0) self.model = playlistmodel.PlaylistModel( @@ -153,7 +152,7 @@ class TestMMMiscRowMove(unittest.TestCase): ) def tearDown(self): - db.drop_all() + ds.db.drop_all() def test_insert_header_row_end(self): # insert header row at end of playlist diff --git a/tests/test_queries.py b/tests/test_queries.py index 7b950e3..a636ab4 100644 --- a/tests/test_queries.py +++ b/tests/test_queries.py @@ -8,7 +8,6 @@ import unittest # Third party imports # App imports -from dbmanager import db from classes import ( Filter, ) @@ -20,7 +19,7 @@ class MyTestCase(unittest.TestCase): def setUpClass(cls): """Runs once before any test in this class""" - db.create_all() + ds.db.create_all() # Create some track entries track1_meta = dict( @@ -55,7 +54,7 @@ class MyTestCase(unittest.TestCase): def tearDownClass(cls): """Runs once after all tests""" - db.drop_all() + ds.db.drop_all() def setUp(self): """Runs before each test""" diff --git a/tests/test_ui.py b/tests/test_ui.py index ad71fbf..0063276 100644 --- a/tests/test_ui.py +++ b/tests/test_ui.py @@ -10,7 +10,6 @@ from pytestqt.plugin import QtBot # type: ignore # App imports from app import playlistmodel, utilities -from dbmanager import db from app import ds, musicmuster from classes import InsertTrack @@ -41,7 +40,7 @@ def with_updown(function): @pytest.mark.usefixtures("qtbot_adapter") class MyTestCase(unittest.TestCase): def up(self): - db.create_all() + ds.db.create_all() self.widget = musicmuster.Window() # self.widget.show() @@ -72,7 +71,7 @@ class MyTestCase(unittest.TestCase): ) def down(self): - db.drop_all() + ds.db.drop_all() @with_updown def test_init(self):