From 5678e0ac18c4ad8fcb04135cea2a080763d95b8e Mon Sep 17 00:00:00 2001 From: JVT038 <47184046+JVT038@users.noreply.github.com> Date: Mon, 29 Jan 2024 17:00:51 +0100 Subject: [PATCH] Fix tests --- tests/test_database.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/test_database.py b/tests/test_database.py index 0ea63c6..7f1e812 100644 --- a/tests/test_database.py +++ b/tests/test_database.py @@ -1,4 +1,3 @@ -from email.policy import default from config import Config from metatube.init import Default from metatube import create_app, db @@ -39,6 +38,11 @@ def testAutoCreation(self): db.drop_all() relative_url = 'sqlite:///' + os.path.join('metatube', Config.SQLALCHEMY_DATABASE_URI.replace('sqlite:///', '')) default = Default(self.app, relative_url) + migrationsPath = os.path.join(Config.BASE_DIR, 'migrations') + if os.path.exists(migrationsPath) and os.path.isdir(migrationsPath) and (os.path.exists(os.path.join(migrationsPath, 'env.py')) and os.path.exists(os.path.join(migrationsPath, 'versions'))): + default.init_db() + else: + default.init_db(False) self.assertTrue(default.init_db()) def testConfigTable(self):